@inweb/client 25.3.12 → 25.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -35
- package/dist/client.js +16 -17365
- package/dist/client.js.map +1 -1
- package/dist/client.min.js +1 -1
- package/dist/client.module.js +3 -5553
- package/dist/client.module.js.map +1 -1
- package/lib/Api/Assembly.d.ts +0 -1
- package/lib/Api/ClashTest.d.ts +0 -1
- package/lib/Api/Client.d.ts +1 -2
- package/lib/Api/ClientEvents.d.ts +0 -1
- package/lib/Api/File.d.ts +0 -1
- package/lib/Api/HttpClient.d.ts +0 -1
- package/lib/Api/IAssembly.d.ts +0 -1
- package/lib/Api/IFile.d.ts +0 -1
- package/lib/Api/IHttpClient.d.ts +0 -1
- package/lib/Api/IUser.d.ts +0 -1
- package/lib/Api/Job.d.ts +0 -1
- package/lib/Api/Member.d.ts +0 -1
- package/lib/Api/Model.d.ts +0 -1
- package/lib/Api/Permission.d.ts +0 -1
- package/lib/Api/Project.d.ts +0 -1
- package/lib/Api/Role.d.ts +0 -1
- package/lib/Api/User.d.ts +0 -1
- package/lib/Api/impl/FetchError.d.ts +0 -1
- package/lib/Api/impl/Utils.d.ts +0 -1
- package/lib/Api/impl/http.d.ts +0 -1
- package/lib/ConvetMath.d.ts +0 -1
- package/lib/index.d.ts +1 -13
- package/package.json +5 -11
- package/src/Api/Client.ts +2 -1
- package/src/index.ts +1 -13
- package/lib/Viewer/CanvasEvents.d.ts +0 -2
- package/lib/Viewer/Commands/ApplyModelTransform.d.ts +0 -2
- package/lib/Viewer/Commands/ClearMarkup.d.ts +0 -2
- package/lib/Viewer/Commands/ClearSlices.d.ts +0 -2
- package/lib/Viewer/Commands/CreatePreview.d.ts +0 -2
- package/lib/Viewer/Commands/Explode.d.ts +0 -2
- package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +0 -2
- package/lib/Viewer/Commands/GetModels.d.ts +0 -2
- package/lib/Viewer/Commands/GetSelected.d.ts +0 -2
- package/lib/Viewer/Commands/HideSelected.d.ts +0 -2
- package/lib/Viewer/Commands/IsolateSelected.d.ts +0 -2
- package/lib/Viewer/Commands/RegenerateAll.d.ts +0 -2
- package/lib/Viewer/Commands/ResetView.d.ts +0 -2
- package/lib/Viewer/Commands/SelectModel.d.ts +0 -2
- package/lib/Viewer/Commands/SetActiveDragger.d.ts +0 -2
- package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +0 -2
- package/lib/Viewer/Commands/SetMarkupColor.d.ts +0 -2
- package/lib/Viewer/Commands/SetSelected.d.ts +0 -2
- package/lib/Viewer/Commands/ShowAll.d.ts +0 -2
- package/lib/Viewer/Commands/Unselect.d.ts +0 -2
- package/lib/Viewer/Commands/ZoomToExtents.d.ts +0 -2
- package/lib/Viewer/Commands/ZoomToObjects.d.ts +0 -2
- package/lib/Viewer/Commands/ZoomToSelected.d.ts +0 -2
- package/lib/Viewer/Commands.d.ts +0 -3
- package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +0 -22
- package/lib/Viewer/Draggers/Actions/PanAction.d.ts +0 -18
- package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +0 -8
- package/lib/Viewer/Draggers/Common/Geometry.d.ts +0 -115
- package/lib/Viewer/Draggers/Common/GestureManager.d.ts +0 -41
- package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +0 -54
- package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +0 -30
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +0 -31
- package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +0 -20
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +0 -24
- package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +0 -27
- package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +0 -8
- package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +0 -8
- package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +0 -8
- package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +0 -15
- package/lib/Viewer/Draggers/OdPanDragger.d.ts +0 -12
- package/lib/Viewer/Draggers/OdZoomDragger.d.ts +0 -12
- package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +0 -11
- package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +0 -19
- package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +0 -14
- package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -15
- package/lib/Viewer/Draggers/OdaTextDragger.d.ts +0 -16
- package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +0 -30
- package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +0 -19
- package/lib/Viewer/EventEmitter2.d.ts +0 -54
- package/lib/Viewer/ICommands.d.ts +0 -25
- package/lib/Viewer/IEventEmitter2.d.ts +0 -13
- package/lib/Viewer/IViewer.d.ts +0 -30
- package/lib/Viewer/Loaders/BaseLoader.d.ts +0 -11
- package/lib/Viewer/Loaders/LoaderFactory.d.ts +0 -11
- package/lib/Viewer/Loaders/TCSLoader.d.ts +0 -5
- package/lib/Viewer/Loaders/UpdaterController.d.ts +0 -15
- package/lib/Viewer/Loaders/VsfXLoader.d.ts +0 -5
- package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +0 -5
- package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +0 -5
- package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +0 -22
- package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +0 -5
- package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +0 -13
- package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +0 -12
- package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +0 -15
- package/lib/Viewer/Markup/Api/IMarkupText.d.ts +0 -13
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +0 -47
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +0 -36
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +0 -41
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +0 -37
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +0 -37
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +0 -39
- package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +0 -38
- package/lib/Viewer/Markup/IMarkup.d.ts +0 -40
- package/lib/Viewer/Markup/IViewpoint.d.ts +0 -129
- package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +0 -72
- package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +0 -19
- package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +0 -34
- package/lib/Viewer/Markup/MarkupFactory.d.ts +0 -7
- package/lib/Viewer/Options.d.ts +0 -239
- package/lib/Viewer/OptionsEvents.d.ts +0 -26
- package/lib/Viewer/Viewer.d.ts +0 -354
- package/lib/Viewer/ViewerCommands.d.ts +0 -23
- package/lib/Viewer/ViewerEvents.d.ts +0 -602
- package/lib/Viewer/utils.d.ts +0 -4
- package/src/Viewer/CanvasEvents.ts +0 -41
- package/src/Viewer/Commands/ApplyModelTransform.ts +0 -70
- package/src/Viewer/Commands/ClearMarkup.ts +0 -28
- package/src/Viewer/Commands/ClearSlices.ts +0 -27
- package/src/Viewer/Commands/CreatePreview.ts +0 -33
- package/src/Viewer/Commands/Explode.ts +0 -38
- package/src/Viewer/Commands/GetDefaultViewPositions.ts +0 -36
- package/src/Viewer/Commands/GetModels.ts +0 -43
- package/src/Viewer/Commands/GetSelected.ts +0 -58
- package/src/Viewer/Commands/HideSelected.ts +0 -37
- package/src/Viewer/Commands/IsolateSelected.ts +0 -37
- package/src/Viewer/Commands/RegenerateAll.ts +0 -37
- package/src/Viewer/Commands/ResetView.ts +0 -43
- package/src/Viewer/Commands/SelectModel.ts +0 -52
- package/src/Viewer/Commands/SetActiveDragger.ts +0 -29
- package/src/Viewer/Commands/SetDefaultViewPosition.ts +0 -50
- package/src/Viewer/Commands/SetMarkupColor.ts +0 -29
- package/src/Viewer/Commands/SetSelected.ts +0 -47
- package/src/Viewer/Commands/ShowAll.ts +0 -37
- package/src/Viewer/Commands/Unselect.ts +0 -37
- package/src/Viewer/Commands/ZoomToExtents.ts +0 -43
- package/src/Viewer/Commands/ZoomToObjects.ts +0 -47
- package/src/Viewer/Commands/ZoomToSelected.ts +0 -39
- package/src/Viewer/Commands.ts +0 -81
- package/src/Viewer/Draggers/Actions/OrbitAction.ts +0 -250
- package/src/Viewer/Draggers/Actions/PanAction.ts +0 -102
- package/src/Viewer/Draggers/Actions/ZoomAction.ts +0 -45
- package/src/Viewer/Draggers/Common/Geometry.ts +0 -152
- package/src/Viewer/Draggers/Common/GestureManager.ts +0 -263
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +0 -270
- package/src/Viewer/Draggers/Common/OdaGeAction.ts +0 -146
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +0 -248
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +0 -182
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +0 -166
- package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +0 -182
- package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +0 -53
- package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +0 -53
- package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +0 -53
- package/src/Viewer/Draggers/OdOrbitDragger.ts +0 -70
- package/src/Viewer/Draggers/OdPanDragger.ts +0 -62
- package/src/Viewer/Draggers/OdZoomDragger.ts +0 -59
- package/src/Viewer/Draggers/OdZoomWheelDragger.ts +0 -103
- package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +0 -123
- package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +0 -75
- package/src/Viewer/Draggers/OdaLineDragger.ts +0 -80
- package/src/Viewer/Draggers/OdaTextDragger.ts +0 -118
- package/src/Viewer/Draggers/OdaWalkDragger.ts +0 -278
- package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +0 -184
- package/src/Viewer/EventEmitter2.ts +0 -116
- package/src/Viewer/ICommands.ts +0 -53
- package/src/Viewer/IEventEmitter2.ts +0 -36
- package/src/Viewer/IViewer.ts +0 -59
- package/src/Viewer/Loaders/BaseLoader.ts +0 -40
- package/src/Viewer/Loaders/LoaderFactory.ts +0 -47
- package/src/Viewer/Loaders/TCSLoader.ts +0 -82
- package/src/Viewer/Loaders/UpdaterController.ts +0 -36
- package/src/Viewer/Loaders/VsfXLoader.ts +0 -65
- package/src/Viewer/Loaders/VsfXPartialLoader.ts +0 -208
- package/src/Viewer/Loaders/VsfXStreamingLoader.ts +0 -87
- package/src/Viewer/Markup/Api/IMarkupArrow.ts +0 -12
- package/src/Viewer/Markup/Api/IMarkupCloud.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupColorable.ts +0 -4
- package/src/Viewer/Markup/Api/IMarkupEllipse.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupImage.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupLine.ts +0 -13
- package/src/Viewer/Markup/Api/IMarkupObject.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupRectangle.ts +0 -15
- package/src/Viewer/Markup/Api/IMarkupText.ts +0 -12
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +0 -117
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +0 -208
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +0 -118
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +0 -123
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +0 -131
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +0 -119
- package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +0 -110
- package/src/Viewer/Markup/IMarkup.ts +0 -41
- package/src/Viewer/Markup/IViewpoint.ts +0 -146
- package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +0 -1144
- package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +0 -39
- package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +0 -228
- package/src/Viewer/Markup/MarkupFactory.ts +0 -32
- package/src/Viewer/Options.ts +0 -527
- package/src/Viewer/OptionsEvents.ts +0 -28
- package/src/Viewer/Viewer.ts +0 -1182
- package/src/Viewer/ViewerCommands.ts +0 -45
- package/src/Viewer/ViewerEvents.ts +0 -705
- package/src/Viewer/utils.ts +0 -74
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
-
// All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This software and its documentation and related materials are owned by
|
|
6
|
-
// the Alliance. The software may only be incorporated into application
|
|
7
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
-
// protected by copyright law and international treaty provisions. Application
|
|
12
|
-
// programs incorporating this software must include the following statement
|
|
13
|
-
// with their copyright notices:
|
|
14
|
-
//
|
|
15
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
-
// license agreement with Open Design Alliance.
|
|
17
|
-
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
-
// All rights reserved.
|
|
19
|
-
//
|
|
20
|
-
// By use of this software, its documentation or related materials, you
|
|
21
|
-
// acknowledge and accept the above terms.
|
|
22
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
-
/* eslint-disable no-unused-vars */
|
|
24
|
-
|
|
25
|
-
import { Viewer } from "../../Viewer";
|
|
26
|
-
import { CANVAS_EVENTS } from "../../CanvasEvents";
|
|
27
|
-
import { Point2d } from "./Geometry";
|
|
28
|
-
import { OdaGeAction } from "./OdaGeAction";
|
|
29
|
-
|
|
30
|
-
const CLICK_DELTA = 5;
|
|
31
|
-
|
|
32
|
-
const INTERACTIVITY_FPS = 24;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A [Viewer]{@link Viewer} event that fires when the viewer needs to be updated.
|
|
36
|
-
*
|
|
37
|
-
* @property {string} type - `update`
|
|
38
|
-
* @event update
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* A [Viewer]{@link Viewer} event that fires when the user selects an entity with the mouse.
|
|
43
|
-
*
|
|
44
|
-
* @property {string} type - `select`
|
|
45
|
-
* @property {OdTvSelectionSet} data - The set of selected entities. For more information, see
|
|
46
|
-
* [OdTvSelectionSet](https://cloud.opendesign.com/docs/index.html#/vis/OdTvSelectionSet?id=odtvselectionset).
|
|
47
|
-
* @event select
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
export class OdBaseDragger extends OdaGeAction {
|
|
51
|
-
protected subject: Viewer;
|
|
52
|
-
protected needInputText: boolean;
|
|
53
|
-
protected mouseDownPosition: Point2d;
|
|
54
|
-
protected autoSelect: boolean;
|
|
55
|
-
protected onmessage: (event: any) => boolean;
|
|
56
|
-
protected canvasEvents: string[];
|
|
57
|
-
protected isDragging: boolean;
|
|
58
|
-
protected press: boolean;
|
|
59
|
-
|
|
60
|
-
public name: string;
|
|
61
|
-
|
|
62
|
-
constructor(subject: Viewer) {
|
|
63
|
-
super(subject.visualizeJs);
|
|
64
|
-
this.subject = subject;
|
|
65
|
-
this.needInputText = false;
|
|
66
|
-
this.mouseDownPosition = { x: 0, y: 0 };
|
|
67
|
-
this.autoSelect = false;
|
|
68
|
-
|
|
69
|
-
this.onmessage = (event) => this.subject.emitEvent(event);
|
|
70
|
-
this.canvasEvents = CANVAS_EVENTS;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public initialize(): void {
|
|
74
|
-
this.canvasEvents = this.canvasEvents.filter((x) => typeof this[x] === "function");
|
|
75
|
-
this.canvasEvents.forEach((x) => (this[x] = this[x].bind(this)));
|
|
76
|
-
this.canvasEvents.forEach((x) => this.subject.on(x, this[x]));
|
|
77
|
-
|
|
78
|
-
this.getViewer().setEnableAutoSelect(!!this.autoSelect);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public dispose(): void {
|
|
82
|
-
this.canvasEvents.forEach((x) => this.subject.off(x, this[x]));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
protected relativeCoords(event: MouseEvent): Point2d {
|
|
86
|
-
return { x: event.offsetX * window.devicePixelRatio, y: event.offsetY * window.devicePixelRatio };
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
protected pointerdown(ev: PointerEvent): void {
|
|
90
|
-
if (!ev.isPrimary || OdBaseDragger.isGestureActive) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
(ev.target as HTMLElement).setPointerCapture(ev.pointerId);
|
|
95
|
-
|
|
96
|
-
const relCoord = this.relativeCoords(ev);
|
|
97
|
-
this.isDragging = true;
|
|
98
|
-
this.mouseDownPosition = { x: relCoord.x, y: relCoord.y };
|
|
99
|
-
this.start(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
|
|
100
|
-
this.subject.update();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
protected pointerup(ev: PointerEvent): void {
|
|
104
|
-
if (OdBaseDragger.needSkipPointerUp) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (!ev.isPrimary) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
(ev.target as HTMLElement).releasePointerCapture(ev.pointerId);
|
|
113
|
-
|
|
114
|
-
const relCoord = this.relativeCoords(ev);
|
|
115
|
-
this.end(relCoord.x, relCoord.y);
|
|
116
|
-
this.isDragging = false;
|
|
117
|
-
this.subject.update();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
protected pointercancel(ev: PointerEvent): void {
|
|
121
|
-
if (!ev.isPrimary) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
this.m_module.canvas.dispatchEvent(new PointerEvent("pointerup", ev));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
protected pointermove(ev: PointerEvent): void {
|
|
129
|
-
if (!ev.isPrimary || OdBaseDragger.isGestureActive) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const relCoord = this.relativeCoords(ev);
|
|
134
|
-
this.drag(relCoord.x, relCoord.y, ev.movementX, ev.movementY);
|
|
135
|
-
if (this.isDragging) {
|
|
136
|
-
this.subject.update();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
protected click(ev: MouseEvent): void {
|
|
141
|
-
const viewer = this.getViewer();
|
|
142
|
-
const relCoord = this.relativeCoords(ev);
|
|
143
|
-
const x = relCoord.x;
|
|
144
|
-
const y = relCoord.y;
|
|
145
|
-
|
|
146
|
-
const isNotDragging =
|
|
147
|
-
Math.abs(x - this.mouseDownPosition.x) < CLICK_DELTA && Math.abs(y - this.mouseDownPosition.y) < CLICK_DELTA;
|
|
148
|
-
|
|
149
|
-
if (viewer && viewer.getEnableAutoSelect() && isNotDragging) {
|
|
150
|
-
viewer.unselect();
|
|
151
|
-
viewer.select(x, y, x, y);
|
|
152
|
-
this.subject.update();
|
|
153
|
-
|
|
154
|
-
const selectionSet = viewer.getSelected();
|
|
155
|
-
const handles = this.subject.getSelected();
|
|
156
|
-
this.onmessage({ type: "select", data: selectionSet, handles });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
protected dblclick(ev: MouseEvent): void {
|
|
161
|
-
const viewer = this.getViewer();
|
|
162
|
-
const relCoord = this.relativeCoords(ev);
|
|
163
|
-
const x = relCoord.x;
|
|
164
|
-
const y = relCoord.y;
|
|
165
|
-
|
|
166
|
-
const device = viewer.getActiveDevice();
|
|
167
|
-
const clickView = device.viewAt([x, y]);
|
|
168
|
-
if (clickView && !clickView.active) {
|
|
169
|
-
viewer.activeView = clickView;
|
|
170
|
-
clickView.delete();
|
|
171
|
-
this.subject.update();
|
|
172
|
-
} else {
|
|
173
|
-
if (viewer && viewer.getEnableAutoSelect()) {
|
|
174
|
-
const pSelected = viewer.getSelected();
|
|
175
|
-
|
|
176
|
-
if (!pSelected.isNull() && pSelected.numItems() !== 0) {
|
|
177
|
-
const itr = pSelected.getIterator();
|
|
178
|
-
const entity = itr.getEntity();
|
|
179
|
-
viewer.zoomToEntity(entity);
|
|
180
|
-
|
|
181
|
-
this.onmessage({ type: "zoomtoentity", data: entity });
|
|
182
|
-
this.subject.update();
|
|
183
|
-
|
|
184
|
-
this.deleteAll([itr, entity]);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
device.delete();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
protected start(x: number, y: number, absoluteX = 0, absoluteY = 0): void {}
|
|
193
|
-
|
|
194
|
-
protected drag(x: number, y: number, absoluteX = 0, absoluteY = 0): void {}
|
|
195
|
-
|
|
196
|
-
protected end(x: number, y: number): void {}
|
|
197
|
-
|
|
198
|
-
protected beginInteractivity = () => {
|
|
199
|
-
const viewer = this.getViewer();
|
|
200
|
-
const view = viewer.activeView;
|
|
201
|
-
if (view["beginInteractivity"]) {
|
|
202
|
-
view.beginInteractivity(INTERACTIVITY_FPS);
|
|
203
|
-
this.subject.update();
|
|
204
|
-
}
|
|
205
|
-
view.delete();
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
protected endInteractivity = () => {
|
|
209
|
-
const viewer = this.getViewer();
|
|
210
|
-
const view = viewer.activeView;
|
|
211
|
-
if (view["endInteractivity"]) {
|
|
212
|
-
view.endInteractivity();
|
|
213
|
-
|
|
214
|
-
const device = this.getViewer().getActiveDevice();
|
|
215
|
-
const canvas = this.m_module.canvas;
|
|
216
|
-
device.invalidate([0, 0, canvas.width, canvas.height]);
|
|
217
|
-
device.delete();
|
|
218
|
-
this.subject.update();
|
|
219
|
-
}
|
|
220
|
-
view.delete();
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
protected getActiveMarkupEntity(entityName: string): any {
|
|
224
|
-
return this.subject.addMarkupEntity(entityName);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
private syncOverlayView(): any {
|
|
228
|
-
return this.subject.syncOverlay();
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
protected deleteAll(objects): void {
|
|
232
|
-
for (const obj of objects) {
|
|
233
|
-
obj?.delete?.();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
public updatePreview(): void {}
|
|
238
|
-
|
|
239
|
-
private static _isGestureActive = false;
|
|
240
|
-
|
|
241
|
-
protected static set isGestureActive(value: boolean) {
|
|
242
|
-
if (OdBaseDragger._isGestureActive === value) {
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
OdBaseDragger._isGestureActive = value;
|
|
247
|
-
if (OdBaseDragger._isGestureActive) {
|
|
248
|
-
OdBaseDragger.needSkipPointerUp = true;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
protected static get isGestureActive() {
|
|
253
|
-
return OdBaseDragger._isGestureActive;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
private static _needSkipPointerUp = false;
|
|
257
|
-
|
|
258
|
-
private static get needSkipPointerUp() {
|
|
259
|
-
if (OdBaseDragger._needSkipPointerUp) {
|
|
260
|
-
OdBaseDragger.needSkipPointerUp = false;
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private static set needSkipPointerUp(value: boolean) {
|
|
268
|
-
OdBaseDragger._needSkipPointerUp = value;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
-
// All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This software and its documentation and related materials are owned by
|
|
6
|
-
// the Alliance. The software may only be incorporated into application
|
|
7
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
-
// protected by copyright law and international treaty provisions. Application
|
|
12
|
-
// programs incorporating this software must include the following statement
|
|
13
|
-
// with their copyright notices:
|
|
14
|
-
//
|
|
15
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
-
// license agreement with Open Design Alliance.
|
|
17
|
-
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
-
// All rights reserved.
|
|
19
|
-
//
|
|
20
|
-
// By use of this software, its documentation or related materials, you
|
|
21
|
-
// acknowledge and accept the above terms.
|
|
22
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
-
import { Matrix3d, OdTvPlane, Point3d, Vector3d } from "./Geometry";
|
|
24
|
-
|
|
25
|
-
export type ViewParams = {
|
|
26
|
-
position: number[];
|
|
27
|
-
target: number[];
|
|
28
|
-
upVector: number[];
|
|
29
|
-
viewFieldWidth: number;
|
|
30
|
-
viewFieldHeight: number;
|
|
31
|
-
perspective: boolean;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export class OdaGeAction {
|
|
35
|
-
protected m_module;
|
|
36
|
-
|
|
37
|
-
constructor(module: any) {
|
|
38
|
-
this.m_module = module;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
protected getViewer(): any {
|
|
42
|
-
return this.m_module.getViewer();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
protected getModel(): any {
|
|
46
|
-
return this.getViewer().getMarkupModel();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected copyPoint(point: Point3d): Point3d {
|
|
50
|
-
const p: Point3d = new this.m_module.Point3d();
|
|
51
|
-
p.set(point.x, point.y, point.z);
|
|
52
|
-
return p;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
protected createVector3d(): Vector3d {
|
|
56
|
-
return new this.m_module.Vector3d();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
protected createPoint3d(): Point3d {
|
|
60
|
-
return new this.m_module.Point3d();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
protected createMatrix3d(): Matrix3d {
|
|
64
|
-
return new this.m_module.Matrix3d();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
protected createPlane(): OdTvPlane {
|
|
68
|
-
return new this.m_module.OdTvPlane();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
protected toVector(geVector): Vector3d {
|
|
72
|
-
return this.m_module.Vector3d.createFromArray(geVector);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
protected toGeVector(v: Vector3d): number[] {
|
|
76
|
-
return [v.x, v.y, v.z];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
protected toGePoint(point: Point3d): number[] {
|
|
80
|
-
return [point.x, point.y, point.z];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
protected toPoint(gePoint: number[]): Point3d {
|
|
84
|
-
return this.m_module.Point3d.createFromArray(gePoint);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
protected screenToWorld(x: number, y: number): Point3d {
|
|
88
|
-
return this.toPoint(this.m_module.getViewer().screenToWorld(x, y));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
protected toDoubleArray(points: Point3d[]): number[] {
|
|
92
|
-
const p: number[] = [];
|
|
93
|
-
for (let i = 0; i < points.length; i++) {
|
|
94
|
-
p.push(points[i].x);
|
|
95
|
-
p.push(points[i].y);
|
|
96
|
-
p.push(points[i].z);
|
|
97
|
-
}
|
|
98
|
-
return p;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
protected correctCameraTarget(): void {
|
|
102
|
-
const params = this.getViewParams();
|
|
103
|
-
const ext = this.m_module.getViewer().getActiveExtents();
|
|
104
|
-
const { min, max } = ext;
|
|
105
|
-
const target = this.toPoint(params.target);
|
|
106
|
-
|
|
107
|
-
const contains =
|
|
108
|
-
target.x >= min.x &&
|
|
109
|
-
target.y >= min.y &&
|
|
110
|
-
target.z >= min.z &&
|
|
111
|
-
target.x <= max.x &&
|
|
112
|
-
target.y <= max.y &&
|
|
113
|
-
target.z <= max.z;
|
|
114
|
-
if (!contains) {
|
|
115
|
-
params.target = ext.center();
|
|
116
|
-
this.setViewParams(params);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
protected setViewParams = (params: ViewParams) => {
|
|
121
|
-
const extView = this.m_module.getViewer().getActiveTvExtendedView();
|
|
122
|
-
extView.setView(
|
|
123
|
-
params.position,
|
|
124
|
-
params.target,
|
|
125
|
-
params.upVector,
|
|
126
|
-
params.viewFieldWidth,
|
|
127
|
-
params.viewFieldHeight,
|
|
128
|
-
params.perspective
|
|
129
|
-
);
|
|
130
|
-
extView.delete?.();
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
protected getViewParams = () => {
|
|
134
|
-
const view = this.m_module.getViewer().activeView;
|
|
135
|
-
const obj = {
|
|
136
|
-
position: view.viewPosition,
|
|
137
|
-
target: view.viewTarget,
|
|
138
|
-
upVector: view.upVector,
|
|
139
|
-
viewFieldWidth: view.viewFieldWidth,
|
|
140
|
-
viewFieldHeight: view.viewFieldHeight,
|
|
141
|
-
perspective: view.perspective,
|
|
142
|
-
} as ViewParams;
|
|
143
|
-
view.delete?.();
|
|
144
|
-
return obj;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
|
|
3
|
-
// All rights reserved.
|
|
4
|
-
//
|
|
5
|
-
// This software and its documentation and related materials are owned by
|
|
6
|
-
// the Alliance. The software may only be incorporated into application
|
|
7
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
-
// protected by copyright law and international treaty provisions. Application
|
|
12
|
-
// programs incorporating this software must include the following statement
|
|
13
|
-
// with their copyright notices:
|
|
14
|
-
//
|
|
15
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
-
// license agreement with Open Design Alliance.
|
|
17
|
-
// Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
|
|
18
|
-
// All rights reserved.
|
|
19
|
-
//
|
|
20
|
-
// By use of this software, its documentation or related materials, you
|
|
21
|
-
// acknowledge and accept the above terms.
|
|
22
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
-
import * as utils from "./MeasureUtils";
|
|
24
|
-
|
|
25
|
-
export class MeasureLineItem {
|
|
26
|
-
protected htmlElemStartPoint: HTMLElement;
|
|
27
|
-
protected htmlElemEndPoint: HTMLElement;
|
|
28
|
-
protected htmlElemLine: HTMLElement;
|
|
29
|
-
protected htmlElemTitle: HTMLElement;
|
|
30
|
-
protected startPoint: number[];
|
|
31
|
-
protected endPoint: number[];
|
|
32
|
-
protected unit: string;
|
|
33
|
-
protected scale: number;
|
|
34
|
-
protected size: number;
|
|
35
|
-
protected style: CSSStyleDeclaration;
|
|
36
|
-
protected viewer: any;
|
|
37
|
-
protected moduleInstance: any;
|
|
38
|
-
protected targetElement: HTMLElement;
|
|
39
|
-
protected isFinishDraw: boolean;
|
|
40
|
-
|
|
41
|
-
public lineThickness: number;
|
|
42
|
-
|
|
43
|
-
constructor(targetElement: HTMLElement, viewer: any, moduleInstance: any) {
|
|
44
|
-
this.htmlElemStartPoint = null;
|
|
45
|
-
this.htmlElemEndPoint = null;
|
|
46
|
-
this.htmlElemLine = null;
|
|
47
|
-
this.htmlElemTitle = null;
|
|
48
|
-
|
|
49
|
-
this.startPoint = null;
|
|
50
|
-
this.endPoint = null;
|
|
51
|
-
|
|
52
|
-
this.unit = "";
|
|
53
|
-
this.scale = 1.0;
|
|
54
|
-
this.size = 10.0;
|
|
55
|
-
this.lineThickness = 2;
|
|
56
|
-
|
|
57
|
-
this.style = {
|
|
58
|
-
border: "2px solid #FFFFFF",
|
|
59
|
-
background: "#009bff",
|
|
60
|
-
color: "white",
|
|
61
|
-
boxShadow: "0 0 10px rgba(0,0,0,0.5)",
|
|
62
|
-
} as CSSStyleDeclaration;
|
|
63
|
-
|
|
64
|
-
this.htmlElemStartPoint = utils.createHtmlElementIfNeed(this.htmlElemStartPoint, targetElement, "ruler-start");
|
|
65
|
-
this.htmlElemEndPoint = utils.createHtmlElementIfNeed(this.htmlElemEndPoint, targetElement, "ruler-end");
|
|
66
|
-
this.htmlElemLine = utils.createHtmlElementIfNeed(this.htmlElemLine, targetElement, "ruler-line");
|
|
67
|
-
this.htmlElemTitle = utils.createHtmlElementIfNeed(this.htmlElemTitle, targetElement, "ruler-value");
|
|
68
|
-
|
|
69
|
-
this.viewer = viewer;
|
|
70
|
-
this.moduleInstance = moduleInstance;
|
|
71
|
-
this.targetElement = targetElement;
|
|
72
|
-
this.isFinishDraw = false;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
drawMeasureLine(): void {
|
|
76
|
-
const pointSize = this.size;
|
|
77
|
-
const rect = this.moduleInstance.canvas.getBoundingClientRect();
|
|
78
|
-
|
|
79
|
-
// draw start point
|
|
80
|
-
if (this.startPoint) {
|
|
81
|
-
this.htmlElemStartPoint = utils.createHtmlElementIfNeed(
|
|
82
|
-
this.htmlElemStartPoint,
|
|
83
|
-
this.targetElement,
|
|
84
|
-
"ruler-start"
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const pScreenStart = utils.worldToScreen(this.startPoint, this.moduleInstance, this.viewer);
|
|
88
|
-
if (utils.isInsideRect(pScreenStart, rect.width, rect.height)) {
|
|
89
|
-
this.htmlElemStartPoint.style.display = "block";
|
|
90
|
-
this.htmlElemStartPoint.style.cursor = "pointer";
|
|
91
|
-
this.htmlElemStartPoint.style.position = "absolute";
|
|
92
|
-
this.htmlElemStartPoint.style.top = `${pScreenStart.y - pointSize / 2}px`;
|
|
93
|
-
this.htmlElemStartPoint.style.left = `${pScreenStart.x - pointSize / 2}px`;
|
|
94
|
-
this.htmlElemStartPoint.style.borderRadius = `${pointSize}px`;
|
|
95
|
-
this.htmlElemStartPoint.style.border = this.style.border;
|
|
96
|
-
this.htmlElemStartPoint.style.background = this.style.background;
|
|
97
|
-
this.htmlElemStartPoint.style.zIndex = "2";
|
|
98
|
-
this.htmlElemStartPoint.style.width = `${pointSize}px`;
|
|
99
|
-
this.htmlElemStartPoint.style.height = `${pointSize}px`;
|
|
100
|
-
this.htmlElemStartPoint.style.boxShadow = this.style.boxShadow;
|
|
101
|
-
} else {
|
|
102
|
-
this.htmlElemStartPoint.style.display = "none";
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// draw end point
|
|
107
|
-
if (this.endPoint && this.isFinishDraw) {
|
|
108
|
-
this.htmlElemEndPoint = utils.createHtmlElementIfNeed(this.htmlElemEndPoint, this.targetElement, "ruler-end");
|
|
109
|
-
|
|
110
|
-
const pScreenEnd = utils.worldToScreen(this.endPoint, this.moduleInstance, this.viewer);
|
|
111
|
-
|
|
112
|
-
if (utils.isInsideRect(pScreenEnd, rect.width, rect.height)) {
|
|
113
|
-
this.htmlElemEndPoint.style.display = "block";
|
|
114
|
-
this.htmlElemEndPoint.style.cursor = "pointer";
|
|
115
|
-
this.htmlElemEndPoint.style.position = "absolute";
|
|
116
|
-
this.htmlElemEndPoint.style.top = `${pScreenEnd.y - pointSize / 2}px`;
|
|
117
|
-
this.htmlElemEndPoint.style.left = `${pScreenEnd.x - pointSize / 2}px`;
|
|
118
|
-
this.htmlElemEndPoint.style.borderRadius = `${pointSize}px`;
|
|
119
|
-
this.htmlElemEndPoint.style.border = this.style.border;
|
|
120
|
-
this.htmlElemEndPoint.style.background = this.style.background;
|
|
121
|
-
this.htmlElemEndPoint.style.zIndex = "2";
|
|
122
|
-
this.htmlElemEndPoint.style.width = `${pointSize}px`;
|
|
123
|
-
this.htmlElemEndPoint.style.height = `${pointSize}px`;
|
|
124
|
-
this.htmlElemEndPoint.style.boxShadow = this.style.boxShadow;
|
|
125
|
-
} else {
|
|
126
|
-
this.htmlElemEndPoint.style.display = "none";
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (this.endPoint && this.startPoint) {
|
|
131
|
-
const point1 = utils.worldToScreen(this.startPoint, this.moduleInstance, this.viewer);
|
|
132
|
-
const point2 = utils.worldToScreen(this.endPoint, this.moduleInstance, this.viewer);
|
|
133
|
-
|
|
134
|
-
const { p1, p2, angle, width } = utils.getDataForDrawLineWithFixed(point1, point2, rect.width, rect.height);
|
|
135
|
-
|
|
136
|
-
const dx = p2.x - p1.x;
|
|
137
|
-
const dy = p2.y - p1.y;
|
|
138
|
-
|
|
139
|
-
const height = this.lineThickness;
|
|
140
|
-
if (utils.isInsideRect(p1, rect.width, rect.height) && utils.isInsideRect(p2, rect.width, rect.height)) {
|
|
141
|
-
this.htmlElemLine = utils.createHtmlElementIfNeed(this.htmlElemLine, this.targetElement, "ruler-line");
|
|
142
|
-
this.htmlElemLine.style.display = "block";
|
|
143
|
-
this.htmlElemLine.style.cursor = "pointer";
|
|
144
|
-
this.htmlElemLine.style.position = "absolute";
|
|
145
|
-
this.htmlElemLine.style.top = `${p1.y}px`;
|
|
146
|
-
this.htmlElemLine.style.left = `${p1.x}px`;
|
|
147
|
-
this.htmlElemLine.style.width = `${width}px`;
|
|
148
|
-
this.htmlElemLine.style.transform = `rotate(${angle}deg)`;
|
|
149
|
-
this.htmlElemLine.style.transformOrigin = `0px ${height / 2}px`;
|
|
150
|
-
this.htmlElemLine.style.boxShadow = this.style.boxShadow;
|
|
151
|
-
this.htmlElemLine.style.border = "none";
|
|
152
|
-
this.htmlElemLine.style.background = this.style.background;
|
|
153
|
-
this.htmlElemLine.style.zIndex = "1";
|
|
154
|
-
this.htmlElemLine.style.height = `${height}px`;
|
|
155
|
-
|
|
156
|
-
const distance = `${this.getDistance()} ${this.unit}`;
|
|
157
|
-
|
|
158
|
-
const pX = p1.x + dx / 2;
|
|
159
|
-
const pY = p1.y + dy / 2;
|
|
160
|
-
|
|
161
|
-
const widthTitle = distance.length * 10;
|
|
162
|
-
|
|
163
|
-
this.htmlElemTitle = utils.createHtmlElementIfNeed(this.htmlElemTitle, this.targetElement, "ruler-value");
|
|
164
|
-
this.htmlElemTitle.style.display = "block";
|
|
165
|
-
this.htmlElemTitle.style.cursor = "pointer";
|
|
166
|
-
this.htmlElemTitle.style.font = "10px";
|
|
167
|
-
this.htmlElemTitle.style.color = "white";
|
|
168
|
-
this.htmlElemTitle.style.position = "Absolute";
|
|
169
|
-
this.htmlElemTitle.style.top = `${pY}px`;
|
|
170
|
-
this.htmlElemTitle.style.left = `${pX - widthTitle / 2}px`;
|
|
171
|
-
this.htmlElemTitle.style.width = `${widthTitle}px`;
|
|
172
|
-
this.htmlElemTitle.style.transformOrigin = "0px 0px";
|
|
173
|
-
this.htmlElemTitle.style.borderRadius = "5px";
|
|
174
|
-
this.htmlElemTitle.style.boxShadow = this.style.boxShadow;
|
|
175
|
-
this.htmlElemTitle.style.border = "none";
|
|
176
|
-
this.htmlElemTitle.style.background = this.style.background;
|
|
177
|
-
this.htmlElemTitle.style.zIndex = "3";
|
|
178
|
-
this.htmlElemTitle.style.padding = "2px";
|
|
179
|
-
this.htmlElemTitle.style.textAlign = "center";
|
|
180
|
-
this.htmlElemTitle.innerHTML = `${distance}`;
|
|
181
|
-
} else {
|
|
182
|
-
this.htmlElemLine.style.display = "none";
|
|
183
|
-
this.htmlElemTitle.style.display = "none";
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
getDistance(): number {
|
|
189
|
-
return utils.getDistance(this.startPoint, this.endPoint, this.moduleInstance) / this.scale;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
setStartPoint(gePoint: number[]): void {
|
|
193
|
-
this.startPoint = gePoint;
|
|
194
|
-
this.drawMeasureLine();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
setEndPoint(gePoint: number[], isFinish: boolean): void {
|
|
198
|
-
this.isFinishDraw = isFinish === undefined ? true : isFinish;
|
|
199
|
-
this.endPoint = gePoint;
|
|
200
|
-
this.drawMeasureLine();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
update(): void {
|
|
204
|
-
this.drawMeasureLine();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
setSize(size: number): void {
|
|
208
|
-
this.size = size;
|
|
209
|
-
this.drawMeasureLine();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
clear(): void {
|
|
213
|
-
this.endPoint = null;
|
|
214
|
-
this.startPoint = null;
|
|
215
|
-
this.htmlElemStartPoint = utils.destroyHtmlElement(this.htmlElemStartPoint, this.targetElement);
|
|
216
|
-
this.htmlElemEndPoint = utils.destroyHtmlElement(this.htmlElemEndPoint, this.targetElement);
|
|
217
|
-
this.htmlElemLine = utils.destroyHtmlElement(this.htmlElemLine, this.targetElement);
|
|
218
|
-
this.htmlElemTitle = utils.destroyHtmlElement(this.htmlElemTitle, this.targetElement);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
setUnit(unit: string): void {
|
|
222
|
-
this.unit = unit;
|
|
223
|
-
this.drawMeasureLine();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
setConversionFactor(scale: number): void {
|
|
227
|
-
this.scale = scale;
|
|
228
|
-
this.drawMeasureLine();
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
setStyle(style: CSSStyleDeclaration): void {
|
|
232
|
-
this.style = style;
|
|
233
|
-
this.drawMeasureLine();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
setSelectionReactor(reactor: any): void {
|
|
237
|
-
utils.onSetCallback(this.htmlElemStartPoint, reactor ? reactor.onStartPoint : null);
|
|
238
|
-
utils.onSetCallback(this.htmlElemEndPoint, reactor ? reactor.onEndPoint : null);
|
|
239
|
-
utils.onSetCallback(this.htmlElemTitle, reactor ? reactor.onTitle : null);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
setSelectability(enable: boolean): void {
|
|
243
|
-
utils.onSetSelectivity(this.htmlElemStartPoint, enable);
|
|
244
|
-
utils.onSetSelectivity(this.htmlElemEndPoint, enable);
|
|
245
|
-
utils.onSetSelectivity(this.htmlElemLine, enable);
|
|
246
|
-
utils.onSetSelectivity(this.htmlElemTitle, enable);
|
|
247
|
-
}
|
|
248
|
-
}
|