@itwin/measure-tools-react
Version:
Frontend framework and tools for measurements
42 lines • 1.77 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { MeasurementToolModel } from "../api/MeasurementToolModel.js";
import { LocationMeasurement } from "../measurements/LocationMeasurement.js";
export class MeasureLocationToolModel extends MeasurementToolModel {
get dynamicMeasurement() { return this._currentMeasurement; }
constructor() {
super();
}
set sheetViewId(id) {
if (this._currentMeasurement)
this._currentMeasurement.sheetViewId = id;
}
get sheetViewId() {
return this._currentMeasurement?.sheetViewId;
}
addLocation(props, isDynamic) {
const { viewType, ...rest } = props;
if (!this._currentMeasurement) {
this._currentMeasurement = new LocationMeasurement(rest);
this.sheetViewId = props.viewId;
this._currentMeasurement.viewTarget.include(viewType);
this._currentMeasurement.isDynamic = isDynamic;
this.notifyNewMeasurement();
}
else {
this._currentMeasurement.changeLocation(props);
this.notifyDynamicMeasurementChanged();
}
if (isDynamic)
return;
this._currentMeasurement.isDynamic = false;
this.addMeasurementAndReset(this._currentMeasurement);
}
reset(clearMeasurements) {
super.reset(clearMeasurements);
this._currentMeasurement = undefined;
}
}
//# sourceMappingURL=MeasureLocationToolModel.js.map