@inweb/viewer-visualize 27.1.6 → 27.1.7
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/dist/viewer-visualize.js +209 -298
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +210 -295
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Components/GestureManagerComponent.d.ts +0 -1
- package/lib/Viewer/Components/ZoomWheelComponent.d.ts +0 -1
- package/lib/Viewer/Draggers/Common/GestureManager.d.ts +1 -0
- package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +0 -4
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +0 -1
- package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +7 -1
- package/lib/Viewer/Draggers/OdaFlyDragger.d.ts +0 -1
- package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +0 -1
- package/lib/Viewer/Viewer.d.ts +5 -42
- package/package.json +5 -5
- package/src/Viewer/Components/GestureManagerComponent.ts +0 -3
- package/src/Viewer/Components/ZoomWheelComponent.ts +0 -3
- package/src/Viewer/Draggers/Actions/OrbitAction.ts +1 -1
- package/src/Viewer/Draggers/Actions/PanAction.ts +1 -1
- package/src/Viewer/Draggers/Actions/ZoomAction.ts +1 -1
- package/src/Viewer/Draggers/Common/GestureManager.ts +9 -0
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +33 -30
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +9 -6
- package/src/Viewer/Draggers/OdZoomWheelDragger.ts +29 -21
- package/src/Viewer/Draggers/OdaFlyDragger.ts +0 -4
- package/src/Viewer/Draggers/OdaWalkDragger.ts +0 -4
- package/src/Viewer/Draggers/index.ts +4 -0
- package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +13 -7
- package/src/Viewer/Viewer.ts +16 -168
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { draggersRegistry, commandsRegistry, componentsRegistry, Loader, loadersRegistry, Options, Info, CANVAS_EVENTS } from '@inweb/viewer-core';
|
|
25
25
|
export * from '@inweb/viewer-core';
|
|
26
26
|
import { EventEmitter2 } from '@inweb/eventemitter2';
|
|
27
27
|
import { Markup } from '@inweb/markup';
|
|
@@ -147,17 +147,27 @@ class OdBaseDragger extends OdaGeAction {
|
|
|
147
147
|
this.needInputText = false;
|
|
148
148
|
this.mouseDownPosition = { x: 0, y: 0 };
|
|
149
149
|
this.autoSelect = false;
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
150
|
+
this.pointerdown = this.pointerdown.bind(this);
|
|
151
|
+
this.pointerup = this.pointerup.bind(this);
|
|
152
|
+
this.pointercancel = this.pointercancel.bind(this);
|
|
153
|
+
this.pointermove = this.pointermove.bind(this);
|
|
154
|
+
this.click = this.click.bind(this);
|
|
155
|
+
this.dblclick = this.dblclick.bind(this);
|
|
156
|
+
this.subject.addEventListener("pointerdown", this.pointerdown);
|
|
157
|
+
this.subject.addEventListener("pointerup", this.pointerup);
|
|
158
|
+
this.subject.addEventListener("pointercancel", this.pointercancel);
|
|
159
|
+
this.subject.addEventListener("pointermove", this.pointermove);
|
|
160
|
+
this.subject.addEventListener("click", this.click);
|
|
161
|
+
this.subject.addEventListener("dblclick", this.dblclick);
|
|
162
|
+
this.getViewer().setEnableAutoSelect(false);
|
|
158
163
|
}
|
|
159
164
|
dispose() {
|
|
160
|
-
this.
|
|
165
|
+
this.subject.removeEventListener("pointerdown", this.pointerdown);
|
|
166
|
+
this.subject.removeEventListener("pointerup", this.pointerup);
|
|
167
|
+
this.subject.removeEventListener("pointercancel", this.pointercancel);
|
|
168
|
+
this.subject.removeEventListener("pointermove", this.pointermove);
|
|
169
|
+
this.subject.removeEventListener("click", this.click);
|
|
170
|
+
this.subject.removeEventListener("dblclick", this.dblclick);
|
|
161
171
|
}
|
|
162
172
|
relativeCoords(event) {
|
|
163
173
|
return { x: event.offsetX * window.devicePixelRatio, y: event.offsetY * window.devicePixelRatio };
|
|
@@ -208,13 +218,13 @@ class OdBaseDragger extends OdaGeAction {
|
|
|
208
218
|
const x = relCoord.x;
|
|
209
219
|
const y = relCoord.y;
|
|
210
220
|
const isNotDragging = Math.abs(x - this.mouseDownPosition.x) < CLICK_DELTA && Math.abs(y - this.mouseDownPosition.y) < CLICK_DELTA;
|
|
211
|
-
if (
|
|
221
|
+
if (this.autoSelect && isNotDragging) {
|
|
212
222
|
viewer.unselect();
|
|
213
223
|
viewer.select(x, y, x, y);
|
|
214
224
|
this.subject.update();
|
|
215
225
|
const selectionSet = viewer.getSelected();
|
|
216
|
-
this.
|
|
217
|
-
this.
|
|
226
|
+
this.subject.emitEvent({ type: "select", data: selectionSet, handles: this.subject.getSelected() });
|
|
227
|
+
this.subject.emitEvent({ type: "select2", data: selectionSet, handles: this.subject.getSelected2() });
|
|
218
228
|
}
|
|
219
229
|
}
|
|
220
230
|
dblclick(ev) {
|
|
@@ -229,17 +239,15 @@ class OdBaseDragger extends OdaGeAction {
|
|
|
229
239
|
clickView.delete();
|
|
230
240
|
this.subject.update();
|
|
231
241
|
}
|
|
232
|
-
else {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.deleteAll([itr, entity]);
|
|
242
|
-
}
|
|
242
|
+
else if (this.autoSelect) {
|
|
243
|
+
const pSelected = viewer.getSelected();
|
|
244
|
+
if (!pSelected.isNull() && pSelected.numItems() !== 0) {
|
|
245
|
+
const itr = pSelected.getIterator();
|
|
246
|
+
const entity = itr.getEntity();
|
|
247
|
+
viewer.zoomToEntity(entity);
|
|
248
|
+
this.subject.emitEvent({ type: "zoomtoentity", data: entity });
|
|
249
|
+
this.subject.update();
|
|
250
|
+
this.deleteAll([itr, entity]);
|
|
243
251
|
}
|
|
244
252
|
}
|
|
245
253
|
device.delete();
|
|
@@ -259,7 +267,6 @@ class OdBaseDragger extends OdaGeAction {
|
|
|
259
267
|
(_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
|
|
260
268
|
}
|
|
261
269
|
}
|
|
262
|
-
updatePreview() { }
|
|
263
270
|
static set isGestureActive(value) {
|
|
264
271
|
if (OdBaseDragger._isGestureActive === value) {
|
|
265
272
|
return;
|
|
@@ -637,23 +644,23 @@ class MeasureLineDragger extends OdBaseDragger {
|
|
|
637
644
|
this.rulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
638
645
|
this.rulerPrecision = (_b = subject.options.rulerPrecision) !== null && _b !== void 0 ? _b : "Default";
|
|
639
646
|
this.items = [];
|
|
640
|
-
this.canvasEvents.push("resize", "optionsChange");
|
|
641
|
-
}
|
|
642
|
-
initialize() {
|
|
643
|
-
super.initialize();
|
|
644
647
|
this.m_overlayElement = document.createElement("div");
|
|
645
648
|
this.m_overlayElement.style.background = "rgba(0,0,0,0)";
|
|
646
649
|
this.m_overlayElement.style.position = "fixed";
|
|
647
650
|
this.m_overlayElement.style.zIndex = "1";
|
|
648
651
|
this.m_overlayElement.style.pointerEvents = "none";
|
|
649
652
|
document.body.appendChild(this.m_overlayElement);
|
|
653
|
+
this.optionsChange = this.optionsChange.bind(this);
|
|
654
|
+
this.updatePreview = this.updatePreview.bind(this);
|
|
650
655
|
this.subject.addEventListener("optionschange", this.optionsChange);
|
|
656
|
+
this.subject.addEventListener("render", this.updatePreview);
|
|
651
657
|
this.resize();
|
|
652
658
|
}
|
|
653
659
|
dispose() {
|
|
654
660
|
super.dispose();
|
|
655
661
|
this.m_overlayElement.remove();
|
|
656
662
|
this.subject.removeEventListener("optionschange", this.optionsChange);
|
|
663
|
+
this.subject.removeEventListener("render", this.updatePreview);
|
|
657
664
|
}
|
|
658
665
|
updatePreview() {
|
|
659
666
|
this.items.forEach((item) => item.update());
|
|
@@ -994,7 +1001,6 @@ const calcFocalLength$1 = (lensLength, fieldWidth, fieldHeight) => {
|
|
|
994
1001
|
class OdaWalkDragger extends OdBaseDragger {
|
|
995
1002
|
constructor(subject) {
|
|
996
1003
|
super(subject);
|
|
997
|
-
this.viewer = undefined;
|
|
998
1004
|
this.multiplier = 5;
|
|
999
1005
|
this.baseSpeed = 1;
|
|
1000
1006
|
this.keyPressMap = new Set();
|
|
@@ -1009,9 +1015,6 @@ class OdaWalkDragger extends OdBaseDragger {
|
|
|
1009
1015
|
this.autoSelect = true;
|
|
1010
1016
|
this.isJoyStickMoving = false;
|
|
1011
1017
|
this.addJoyStickDragger(subject.canvas.parentElement);
|
|
1012
|
-
}
|
|
1013
|
-
initialize() {
|
|
1014
|
-
super.initialize();
|
|
1015
1018
|
this.viewer = this.getViewer();
|
|
1016
1019
|
window.addEventListener("keydown", this.keydown, false);
|
|
1017
1020
|
window.addEventListener("keyup", this.keyup, false);
|
|
@@ -1274,7 +1277,6 @@ const calcFocalLength = (lensLength, fieldWidth, fieldHeight) => {
|
|
|
1274
1277
|
class OdaFlyDragger extends OdBaseDragger {
|
|
1275
1278
|
constructor(subject) {
|
|
1276
1279
|
super(subject);
|
|
1277
|
-
this.viewer = undefined;
|
|
1278
1280
|
this.multiplier = 5;
|
|
1279
1281
|
this.speed = 1;
|
|
1280
1282
|
this.keyPressMap = new Set();
|
|
@@ -1289,9 +1291,6 @@ class OdaFlyDragger extends OdBaseDragger {
|
|
|
1289
1291
|
this.autoSelect = true;
|
|
1290
1292
|
this.isJoyStickMoving = false;
|
|
1291
1293
|
this.addJoyStickDragger(subject.canvas.parentElement);
|
|
1292
|
-
}
|
|
1293
|
-
initialize() {
|
|
1294
|
-
super.initialize();
|
|
1295
1294
|
this.viewer = this.getViewer();
|
|
1296
1295
|
window.addEventListener("keydown", this.keydown, false);
|
|
1297
1296
|
window.addEventListener("keyup", this.keyup, false);
|
|
@@ -1730,7 +1729,6 @@ class OrbitAction {
|
|
|
1730
1729
|
this._beginInteractivity();
|
|
1731
1730
|
}
|
|
1732
1731
|
action(x, y) {
|
|
1733
|
-
var _a, _b;
|
|
1734
1732
|
const view = this.getViewer().activeView;
|
|
1735
1733
|
const corners = view.vportRect;
|
|
1736
1734
|
const size = Math.max(Math.abs(corners[2] - corners[0]), Math.abs(corners[3] - corners[1]));
|
|
@@ -1760,7 +1758,7 @@ class OrbitAction {
|
|
|
1760
1758
|
const extView = this.getViewer().getActiveTvExtendedView();
|
|
1761
1759
|
extView.setView(viewParams.position, viewParams.target, viewParams.upVector, viewParams.viewFieldWidth, viewParams.viewFieldHeight, viewParams.perspective);
|
|
1762
1760
|
extView.delete();
|
|
1763
|
-
|
|
1761
|
+
this._subject.update();
|
|
1764
1762
|
this._subject.emitEvent({
|
|
1765
1763
|
type: "orbit",
|
|
1766
1764
|
});
|
|
@@ -1947,7 +1945,6 @@ class PanAction {
|
|
|
1947
1945
|
this._beginInteractivity();
|
|
1948
1946
|
}
|
|
1949
1947
|
action(x, y, absoluteX, absoluteY) {
|
|
1950
|
-
var _a, _b;
|
|
1951
1948
|
const { Vector3d } = this._m_module;
|
|
1952
1949
|
const params = this._getViewParams();
|
|
1953
1950
|
const pt = this.screenToWorld(x, y);
|
|
@@ -1964,7 +1961,7 @@ class PanAction {
|
|
|
1964
1961
|
targetWithDelta.delete();
|
|
1965
1962
|
position.delete();
|
|
1966
1963
|
positionWithDelta.delete();
|
|
1967
|
-
|
|
1964
|
+
this._subject.update();
|
|
1968
1965
|
this._subject.emitEvent({
|
|
1969
1966
|
type: "pan",
|
|
1970
1967
|
x: absoluteX,
|
|
@@ -2013,11 +2010,10 @@ class ZoomAction {
|
|
|
2013
2010
|
this._subject = subject;
|
|
2014
2011
|
}
|
|
2015
2012
|
action(x, y, zoomFactor, absoluteX, absoluteY) {
|
|
2016
|
-
var _a, _b;
|
|
2017
2013
|
const viewer = this._m_module.getViewer();
|
|
2018
2014
|
viewer.zoomAt(zoomFactor, x, y);
|
|
2019
2015
|
this._subject.deviceAutoRegeneration();
|
|
2020
|
-
|
|
2016
|
+
this._subject.update();
|
|
2021
2017
|
this._subject.emitEvent({
|
|
2022
2018
|
type: "zoomat",
|
|
2023
2019
|
data: zoomFactor,
|
|
@@ -2065,11 +2061,27 @@ const INTERACTIVITY_TIME_OUT = 100;
|
|
|
2065
2061
|
class OdZoomWheelDragger extends OdBaseDragger {
|
|
2066
2062
|
constructor(subject) {
|
|
2067
2063
|
super(subject);
|
|
2068
|
-
this.
|
|
2064
|
+
this.wheel = this.wheel.bind(this);
|
|
2065
|
+
this.subject.addEventListener("wheel", this.wheel);
|
|
2069
2066
|
this._zoomAction = new ZoomAction(this.m_module, this.subject);
|
|
2070
2067
|
this._endInteractivityTimeOutId = undefined;
|
|
2071
2068
|
this._isEnableInteractivityMode = false;
|
|
2072
2069
|
}
|
|
2070
|
+
dispose() {
|
|
2071
|
+
super.dispose();
|
|
2072
|
+
this.subject.removeEventListener("wheel", this.wheel);
|
|
2073
|
+
if (this._endInteractivityTimeOutId) {
|
|
2074
|
+
clearTimeout(this._endInteractivityTimeOutId);
|
|
2075
|
+
this.endInteractivity();
|
|
2076
|
+
this._isEnableInteractivityMode = false;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
pointerdown() { }
|
|
2080
|
+
pointerup() { }
|
|
2081
|
+
pointercancel() { }
|
|
2082
|
+
pointermove() { }
|
|
2083
|
+
click() { }
|
|
2084
|
+
dblclick() { }
|
|
2073
2085
|
wheel(event) {
|
|
2074
2086
|
if (!this.subject.options.enableZoomWheel) {
|
|
2075
2087
|
return;
|
|
@@ -2089,13 +2101,6 @@ class OdZoomWheelDragger extends OdBaseDragger {
|
|
|
2089
2101
|
if (this._endInteractivityTimeOutId) {
|
|
2090
2102
|
clearTimeout(this._endInteractivityTimeOutId);
|
|
2091
2103
|
}
|
|
2092
|
-
if (!this._isEnableInteractivityMode) {
|
|
2093
|
-
this._isEnableInteractivityMode = true;
|
|
2094
|
-
this.beginInteractivity();
|
|
2095
|
-
}
|
|
2096
|
-
if (this._endInteractivityTimeOutId) {
|
|
2097
|
-
clearTimeout(this._endInteractivityTimeOutId);
|
|
2098
|
-
}
|
|
2099
2104
|
this.subject.update(true);
|
|
2100
2105
|
this._endInteractivityTimeOutId = setTimeout(() => {
|
|
2101
2106
|
this._endInteractivityTimeOutId = undefined;
|
|
@@ -2104,13 +2109,6 @@ class OdZoomWheelDragger extends OdBaseDragger {
|
|
|
2104
2109
|
}, INTERACTIVITY_TIME_OUT);
|
|
2105
2110
|
}
|
|
2106
2111
|
}
|
|
2107
|
-
dispose() {
|
|
2108
|
-
if (this._endInteractivityTimeOutId) {
|
|
2109
|
-
clearTimeout(this._endInteractivityTimeOutId);
|
|
2110
|
-
this.endInteractivity();
|
|
2111
|
-
this._isEnableInteractivityMode = false;
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
2112
|
}
|
|
2115
2113
|
|
|
2116
2114
|
class OdSelectionFrame {
|
|
@@ -2330,6 +2328,127 @@ class OrbitAroundBuildingDragger extends OdBaseDragger {
|
|
|
2330
2328
|
}
|
|
2331
2329
|
}
|
|
2332
2330
|
|
|
2331
|
+
const MARKUP_ENTITY_LINE = "$MarkupTempEntity_Line";
|
|
2332
|
+
class OdaLineDragger extends OdBaseDragger {
|
|
2333
|
+
constructor(subject) {
|
|
2334
|
+
super(subject);
|
|
2335
|
+
this.press = false;
|
|
2336
|
+
}
|
|
2337
|
+
dispose() {
|
|
2338
|
+
super.dispose();
|
|
2339
|
+
this.end();
|
|
2340
|
+
this.points = null;
|
|
2341
|
+
this.drawPoints = null;
|
|
2342
|
+
}
|
|
2343
|
+
start(x, y) {
|
|
2344
|
+
const point = this.getViewer().screenToWorld(x, y);
|
|
2345
|
+
this.drawPoints = [point[0], point[1], point[2]];
|
|
2346
|
+
}
|
|
2347
|
+
drag(x, y) {
|
|
2348
|
+
if (this.isDragging) {
|
|
2349
|
+
const point = this.getViewer().screenToWorld(x, y);
|
|
2350
|
+
this.drawPoints.push(point[0], point[1], point[2]);
|
|
2351
|
+
this._updateFrame();
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
end() {
|
|
2355
|
+
if (this.entity) {
|
|
2356
|
+
this.entity.delete();
|
|
2357
|
+
this.drawPoints = null;
|
|
2358
|
+
this.entity = null;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
_updateFrame() {
|
|
2362
|
+
if (this.entity) {
|
|
2363
|
+
const model = this.getViewer().getMarkupModel();
|
|
2364
|
+
model.removeEntity(this.entity);
|
|
2365
|
+
model.delete();
|
|
2366
|
+
this.entity.delete();
|
|
2367
|
+
}
|
|
2368
|
+
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_LINE);
|
|
2369
|
+
const entityPtr = this.entity.openObject();
|
|
2370
|
+
entityPtr.appendPolyline(this.drawPoints).delete();
|
|
2371
|
+
entityPtr.delete();
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
const MARKUP_ENTITY_TEXT = "$MarkupTempEntity_Text";
|
|
2376
|
+
class OdaTextDragger extends OdBaseDragger {
|
|
2377
|
+
constructor(subject) {
|
|
2378
|
+
super(subject);
|
|
2379
|
+
this.TEXT_HEIGHT_ALIGN = 24;
|
|
2380
|
+
this.press = false;
|
|
2381
|
+
}
|
|
2382
|
+
dispose() {
|
|
2383
|
+
var _a;
|
|
2384
|
+
super.dispose();
|
|
2385
|
+
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2386
|
+
this.textRef = null;
|
|
2387
|
+
}
|
|
2388
|
+
_finishInput() {
|
|
2389
|
+
var _a;
|
|
2390
|
+
if (this.textRef && this.textRef.value.trimLeft()) {
|
|
2391
|
+
this._updateFrame();
|
|
2392
|
+
}
|
|
2393
|
+
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2394
|
+
this.textRef = null;
|
|
2395
|
+
}
|
|
2396
|
+
start(x, y, absoluteX, absoluteY) {
|
|
2397
|
+
if (!this.textRef) {
|
|
2398
|
+
this.textRef = document.createElement("textarea");
|
|
2399
|
+
this.textRef.style.zIndex = "9999";
|
|
2400
|
+
this.textRef.style.position = "absolute";
|
|
2401
|
+
this.textRef.style.display = "block";
|
|
2402
|
+
this.textRef.style.top = absoluteY + "px";
|
|
2403
|
+
this.textRef.style.left = absoluteX + "px";
|
|
2404
|
+
this.textRef.onkeypress = (event) => {
|
|
2405
|
+
if (event.key === "Enter") {
|
|
2406
|
+
event.preventDefault();
|
|
2407
|
+
this._finishInput();
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
document.body.appendChild(this.textRef);
|
|
2411
|
+
this.press = true;
|
|
2412
|
+
this.m_center = this.screenToWorld(x, y + this.TEXT_HEIGHT_ALIGN);
|
|
2413
|
+
this.needInputText = true;
|
|
2414
|
+
}
|
|
2415
|
+
else {
|
|
2416
|
+
this._finishInput();
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
_updateFrame() {
|
|
2420
|
+
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_TEXT);
|
|
2421
|
+
const entityPtr = this.entity.openObject();
|
|
2422
|
+
const view = this.getViewer().activeView;
|
|
2423
|
+
const pos = this.toPoint(view.viewPosition);
|
|
2424
|
+
const target = this.toPoint(view.viewTarget);
|
|
2425
|
+
const eyeToWorld = view.eyeToWorldMatrix;
|
|
2426
|
+
const eyeDir = pos.sub(target).asVector();
|
|
2427
|
+
const xDir = this.toVector([1.0, 0.0, 0.0]);
|
|
2428
|
+
const direction = xDir.transformBy(eyeToWorld);
|
|
2429
|
+
const mtrx = this.createMatrix3d();
|
|
2430
|
+
mtrx.setToWorldToPlane(this.toGeVector(eyeDir));
|
|
2431
|
+
direction.transformBy(mtrx);
|
|
2432
|
+
const angel = -Math.atan2(-direction.y, direction.x);
|
|
2433
|
+
const textSize = 0.02;
|
|
2434
|
+
let textScale = 1.0;
|
|
2435
|
+
const projMtrx = view.projectionMatrix;
|
|
2436
|
+
const mtrxNumber = projMtrx.get(1, 1);
|
|
2437
|
+
const tol = 1.0e-6;
|
|
2438
|
+
if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
|
|
2439
|
+
textScale = 1 / mtrxNumber;
|
|
2440
|
+
}
|
|
2441
|
+
const geomData = entityPtr.appendText(this.toGePoint(this.m_center), this.textRef.value.trimLeft());
|
|
2442
|
+
const textPtr = geomData.openAsText();
|
|
2443
|
+
textPtr.setNormal(this.toGeVector(eyeDir));
|
|
2444
|
+
textPtr.setRotation(angel);
|
|
2445
|
+
textPtr.setTextSize(textSize * textScale);
|
|
2446
|
+
textPtr.delete();
|
|
2447
|
+
geomData.delete();
|
|
2448
|
+
entityPtr.delete();
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2333
2452
|
const draggers = draggersRegistry("visualizejs");
|
|
2334
2453
|
draggers.registerDragger("Pan", (viewer) => new OdPanDragger(viewer));
|
|
2335
2454
|
draggers.registerDragger("Orbit", (viewer) => new OdOrbitDragger(viewer));
|
|
@@ -2343,6 +2462,8 @@ draggers.registerDragger("CuttingPlaneYAxis", (viewer) => new OdCuttingPlaneYAxi
|
|
|
2343
2462
|
draggers.registerDragger("CuttingPlaneZAxis", (viewer) => new OdCuttingPlaneZAxisDragger(viewer));
|
|
2344
2463
|
draggers.registerDragger("Walk", (viewer) => new OdaWalkDragger(viewer));
|
|
2345
2464
|
draggers.registerDragger("Fly", (viewer) => new OdaFlyDragger(viewer));
|
|
2465
|
+
draggers.registerDragger("Line", (viewer) => new OdaLineDragger(viewer));
|
|
2466
|
+
draggers.registerDragger("Text", (viewer) => new OdaTextDragger(viewer));
|
|
2346
2467
|
|
|
2347
2468
|
const composeMatrixFromTransform = (transform, modelCenter, visLib) => {
|
|
2348
2469
|
const { translate, scale, rotation } = transform;
|
|
@@ -2939,10 +3060,8 @@ class RenderLoopComponent {
|
|
|
2939
3060
|
|
|
2940
3061
|
class ZoomWheelComponent {
|
|
2941
3062
|
constructor(viewer) {
|
|
2942
|
-
this.viewer = viewer;
|
|
2943
3063
|
this.zoomWheelDragger = new OdZoomWheelDragger(viewer);
|
|
2944
3064
|
this.zoomWheelDragger.name = "ZoomWheel";
|
|
2945
|
-
this.zoomWheelDragger.initialize();
|
|
2946
3065
|
}
|
|
2947
3066
|
dispose() {
|
|
2948
3067
|
this.zoomWheelDragger.dispose();
|
|
@@ -2974,6 +3093,12 @@ class GestureManager extends OdBaseDragger {
|
|
|
2974
3093
|
this._orbitAction = new OrbitAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity);
|
|
2975
3094
|
this._panAction = new PanAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity, this.getViewParams, this.setViewParams);
|
|
2976
3095
|
this._zoomAction = new ZoomAction(this.m_module, this.subject);
|
|
3096
|
+
this.pointerleave = this.pointerleave.bind(this);
|
|
3097
|
+
this.subject.addEventListener("pointerleave", this.pointerleave);
|
|
3098
|
+
}
|
|
3099
|
+
dispose() {
|
|
3100
|
+
super.dispose();
|
|
3101
|
+
this.subject.removeEventListener("pointerleave", this.pointerleave);
|
|
2977
3102
|
}
|
|
2978
3103
|
getMiddlePoint(events) {
|
|
2979
3104
|
if (events.size !== 2) {
|
|
@@ -3130,9 +3255,7 @@ class GestureManager extends OdBaseDragger {
|
|
|
3130
3255
|
|
|
3131
3256
|
class GestureManagerComponent {
|
|
3132
3257
|
constructor(viewer) {
|
|
3133
|
-
this.viewer = viewer;
|
|
3134
3258
|
this.gestureManager = new GestureManager(viewer);
|
|
3135
|
-
this.gestureManager.initialize();
|
|
3136
3259
|
}
|
|
3137
3260
|
dispose() {
|
|
3138
3261
|
this.gestureManager.dispose();
|
|
@@ -3724,127 +3847,6 @@ const loadVisualizeJs = async (url, onprogress, params = {}) => {
|
|
|
3724
3847
|
});
|
|
3725
3848
|
};
|
|
3726
3849
|
|
|
3727
|
-
const MARKUP_ENTITY_LINE = "$MarkupTempEntity_Line";
|
|
3728
|
-
class OdaLineDragger extends OdBaseDragger {
|
|
3729
|
-
constructor(subject) {
|
|
3730
|
-
super(subject);
|
|
3731
|
-
this.press = false;
|
|
3732
|
-
}
|
|
3733
|
-
dispose() {
|
|
3734
|
-
super.dispose();
|
|
3735
|
-
this.end();
|
|
3736
|
-
this.points = null;
|
|
3737
|
-
this.drawPoints = null;
|
|
3738
|
-
}
|
|
3739
|
-
start(x, y) {
|
|
3740
|
-
const point = this.getViewer().screenToWorld(x, y);
|
|
3741
|
-
this.drawPoints = [point[0], point[1], point[2]];
|
|
3742
|
-
}
|
|
3743
|
-
drag(x, y) {
|
|
3744
|
-
if (this.isDragging) {
|
|
3745
|
-
const point = this.getViewer().screenToWorld(x, y);
|
|
3746
|
-
this.drawPoints.push(point[0], point[1], point[2]);
|
|
3747
|
-
this._updateFrame();
|
|
3748
|
-
}
|
|
3749
|
-
}
|
|
3750
|
-
end() {
|
|
3751
|
-
if (this.entity) {
|
|
3752
|
-
this.entity.delete();
|
|
3753
|
-
this.drawPoints = null;
|
|
3754
|
-
this.entity = null;
|
|
3755
|
-
}
|
|
3756
|
-
}
|
|
3757
|
-
_updateFrame() {
|
|
3758
|
-
if (this.entity) {
|
|
3759
|
-
const model = this.getViewer().getMarkupModel();
|
|
3760
|
-
model.removeEntity(this.entity);
|
|
3761
|
-
model.delete();
|
|
3762
|
-
this.entity.delete();
|
|
3763
|
-
}
|
|
3764
|
-
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_LINE);
|
|
3765
|
-
const entityPtr = this.entity.openObject();
|
|
3766
|
-
entityPtr.appendPolyline(this.drawPoints).delete();
|
|
3767
|
-
entityPtr.delete();
|
|
3768
|
-
}
|
|
3769
|
-
}
|
|
3770
|
-
|
|
3771
|
-
const MARKUP_ENTITY_TEXT = "$MarkupTempEntity_Text";
|
|
3772
|
-
class OdaTextDragger extends OdBaseDragger {
|
|
3773
|
-
constructor(subject) {
|
|
3774
|
-
super(subject);
|
|
3775
|
-
this.TEXT_HEIGHT_ALIGN = 24;
|
|
3776
|
-
this.press = false;
|
|
3777
|
-
}
|
|
3778
|
-
dispose() {
|
|
3779
|
-
var _a;
|
|
3780
|
-
super.dispose();
|
|
3781
|
-
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
3782
|
-
this.textRef = null;
|
|
3783
|
-
}
|
|
3784
|
-
_finishInput() {
|
|
3785
|
-
var _a;
|
|
3786
|
-
if (this.textRef && this.textRef.value.trimLeft()) {
|
|
3787
|
-
this._updateFrame();
|
|
3788
|
-
}
|
|
3789
|
-
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
3790
|
-
this.textRef = null;
|
|
3791
|
-
}
|
|
3792
|
-
start(x, y, absoluteX, absoluteY) {
|
|
3793
|
-
if (!this.textRef) {
|
|
3794
|
-
this.textRef = document.createElement("textarea");
|
|
3795
|
-
this.textRef.style.zIndex = "9999";
|
|
3796
|
-
this.textRef.style.position = "absolute";
|
|
3797
|
-
this.textRef.style.display = "block";
|
|
3798
|
-
this.textRef.style.top = absoluteY + "px";
|
|
3799
|
-
this.textRef.style.left = absoluteX + "px";
|
|
3800
|
-
this.textRef.onkeypress = (event) => {
|
|
3801
|
-
if (event.key === "Enter") {
|
|
3802
|
-
event.preventDefault();
|
|
3803
|
-
this._finishInput();
|
|
3804
|
-
}
|
|
3805
|
-
};
|
|
3806
|
-
document.body.appendChild(this.textRef);
|
|
3807
|
-
this.press = true;
|
|
3808
|
-
this.m_center = this.screenToWorld(x, y + this.TEXT_HEIGHT_ALIGN);
|
|
3809
|
-
this.needInputText = true;
|
|
3810
|
-
}
|
|
3811
|
-
else {
|
|
3812
|
-
this._finishInput();
|
|
3813
|
-
}
|
|
3814
|
-
}
|
|
3815
|
-
_updateFrame() {
|
|
3816
|
-
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_TEXT);
|
|
3817
|
-
const entityPtr = this.entity.openObject();
|
|
3818
|
-
const view = this.getViewer().activeView;
|
|
3819
|
-
const pos = this.toPoint(view.viewPosition);
|
|
3820
|
-
const target = this.toPoint(view.viewTarget);
|
|
3821
|
-
const eyeToWorld = view.eyeToWorldMatrix;
|
|
3822
|
-
const eyeDir = pos.sub(target).asVector();
|
|
3823
|
-
const xDir = this.toVector([1.0, 0.0, 0.0]);
|
|
3824
|
-
const direction = xDir.transformBy(eyeToWorld);
|
|
3825
|
-
const mtrx = this.createMatrix3d();
|
|
3826
|
-
mtrx.setToWorldToPlane(this.toGeVector(eyeDir));
|
|
3827
|
-
direction.transformBy(mtrx);
|
|
3828
|
-
const angel = -Math.atan2(-direction.y, direction.x);
|
|
3829
|
-
const textSize = 0.02;
|
|
3830
|
-
let textScale = 1.0;
|
|
3831
|
-
const projMtrx = view.projectionMatrix;
|
|
3832
|
-
const mtrxNumber = projMtrx.get(1, 1);
|
|
3833
|
-
const tol = 1.0e-6;
|
|
3834
|
-
if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
|
|
3835
|
-
textScale = 1 / mtrxNumber;
|
|
3836
|
-
}
|
|
3837
|
-
const geomData = entityPtr.appendText(this.toGePoint(this.m_center), this.textRef.value.trimLeft());
|
|
3838
|
-
const textPtr = geomData.openAsText();
|
|
3839
|
-
textPtr.setNormal(this.toGeVector(eyeDir));
|
|
3840
|
-
textPtr.setRotation(angel);
|
|
3841
|
-
textPtr.setTextSize(textSize * textScale);
|
|
3842
|
-
textPtr.delete();
|
|
3843
|
-
geomData.delete();
|
|
3844
|
-
entityPtr.delete();
|
|
3845
|
-
}
|
|
3846
|
-
}
|
|
3847
|
-
|
|
3848
3850
|
class VisualizeMarkup {
|
|
3849
3851
|
constructor() {
|
|
3850
3852
|
this._markupColor = { r: 255, g: 0, b: 0 };
|
|
@@ -3853,8 +3855,6 @@ class VisualizeMarkup {
|
|
|
3853
3855
|
}
|
|
3854
3856
|
initialize(container, containerEvents, viewer, worldTransformer) {
|
|
3855
3857
|
this._viewer = viewer;
|
|
3856
|
-
this._viewer.registerDragger("Line", OdaLineDragger);
|
|
3857
|
-
this._viewer.registerDragger("Text", OdaTextDragger);
|
|
3858
3858
|
}
|
|
3859
3859
|
dispose() { }
|
|
3860
3860
|
syncOverlay() { }
|
|
@@ -3893,7 +3893,7 @@ class VisualizeMarkup {
|
|
|
3893
3893
|
this._viewer.update();
|
|
3894
3894
|
}
|
|
3895
3895
|
colorizeSelectedMarkups(r = 255, g = 0, b = 0) {
|
|
3896
|
-
|
|
3896
|
+
console.warn("VisualizeMarkup: colorizeSelectedMarkups() not implemented yet");
|
|
3897
3897
|
}
|
|
3898
3898
|
setViewpoint(viewpoint) {
|
|
3899
3899
|
function getLogicalPoint3dAsArray(point3d) {
|
|
@@ -4003,19 +4003,28 @@ class VisualizeMarkup {
|
|
|
4003
4003
|
return ((_a = visLib.canvas) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality)) || "";
|
|
4004
4004
|
}
|
|
4005
4005
|
enableEditMode(mode) {
|
|
4006
|
+
if (mode === "Line" || mode === "Text")
|
|
4007
|
+
this._viewer.setActiveDragger(mode);
|
|
4006
4008
|
return this;
|
|
4007
4009
|
}
|
|
4008
4010
|
createObject(type, params) {
|
|
4011
|
+
console.warn("VisualizeMarkup: createObject() not implemented yet");
|
|
4009
4012
|
return undefined;
|
|
4010
4013
|
}
|
|
4011
4014
|
getObjects() {
|
|
4015
|
+
console.warn("VisualizeMarkup: getObjects() not implemented yet");
|
|
4012
4016
|
return [];
|
|
4013
4017
|
}
|
|
4014
4018
|
getSelectedObjects() {
|
|
4019
|
+
console.warn("VisualizeMarkup: getSelectedObjects() not implemented yet");
|
|
4015
4020
|
return [];
|
|
4016
4021
|
}
|
|
4017
|
-
selectObjects(objects) {
|
|
4018
|
-
|
|
4022
|
+
selectObjects(objects) {
|
|
4023
|
+
console.warn("VisualizeMarkup: selectObjects() not implemented yet");
|
|
4024
|
+
}
|
|
4025
|
+
clearSelected() {
|
|
4026
|
+
console.warn("VisualizeMarkup: clearSelected() not implemented yet");
|
|
4027
|
+
}
|
|
4019
4028
|
}
|
|
4020
4029
|
|
|
4021
4030
|
class MarkupFactory {
|
|
@@ -4056,7 +4065,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4056
4065
|
this._renderNeeded = false;
|
|
4057
4066
|
this._renderTime = 0;
|
|
4058
4067
|
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
|
|
4059
|
-
this.
|
|
4068
|
+
this._maxRegenTime = 0;
|
|
4060
4069
|
this.render = this.render.bind(this);
|
|
4061
4070
|
this.update = this.update.bind(this);
|
|
4062
4071
|
this._markup = MarkupFactory.createMarkup(params.markupType);
|
|
@@ -4162,18 +4171,6 @@ class Viewer extends EventEmitter2 {
|
|
|
4162
4171
|
this.emitEvent({ type: "resize", width, height });
|
|
4163
4172
|
this.update(true);
|
|
4164
4173
|
}
|
|
4165
|
-
resize() {
|
|
4166
|
-
console.warn("Viewer.resize() has been deprecated since 26.9 and will be removed in a future release, use Viewer.setSize() instead.");
|
|
4167
|
-
if (!this.visualizeJs)
|
|
4168
|
-
return this;
|
|
4169
|
-
if (!this.canvas.parentElement)
|
|
4170
|
-
return this;
|
|
4171
|
-
const { width, height } = this.canvas.parentElement.getBoundingClientRect();
|
|
4172
|
-
if (!width || !height)
|
|
4173
|
-
return this;
|
|
4174
|
-
this.setSize(width, height);
|
|
4175
|
-
return this;
|
|
4176
|
-
}
|
|
4177
4174
|
update(force = false) {
|
|
4178
4175
|
const time = performance.now();
|
|
4179
4176
|
force = force || time - this._renderTime >= this._updateDelay;
|
|
@@ -4185,11 +4182,8 @@ class Viewer extends EventEmitter2 {
|
|
|
4185
4182
|
this.emitEvent({ type: "update", force });
|
|
4186
4183
|
}
|
|
4187
4184
|
render(time) {
|
|
4188
|
-
var _a, _b;
|
|
4189
4185
|
if (!this.visualizeJs)
|
|
4190
4186
|
return;
|
|
4191
|
-
if (this._isRunAsyncUpdate)
|
|
4192
|
-
return;
|
|
4193
4187
|
const renderNeeded = this.visViewer().isRunningAnimation() || this._renderNeeded;
|
|
4194
4188
|
if (!renderNeeded)
|
|
4195
4189
|
return;
|
|
@@ -4198,8 +4192,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4198
4192
|
const deltaTime = (time - this._renderTime) / 1000;
|
|
4199
4193
|
this._renderTime = time;
|
|
4200
4194
|
this._renderNeeded = !this.visViewer().getActiveDevice().isValid();
|
|
4201
|
-
this.visViewer().update();
|
|
4202
|
-
(_b = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4195
|
+
this.visViewer().update(this._maxRegenTime);
|
|
4203
4196
|
this.emitEvent({ type: "render", time, deltaTime });
|
|
4204
4197
|
}
|
|
4205
4198
|
async loadReferences(model) {
|
|
@@ -4217,12 +4210,12 @@ class Viewer extends EventEmitter2 {
|
|
|
4217
4210
|
await model
|
|
4218
4211
|
.getReferences(abortController.signal)
|
|
4219
4212
|
.then((data) => (references = data.references))
|
|
4220
|
-
.catch((e) => console.error("Cannot load model references.", e));
|
|
4213
|
+
.catch((e) => console.error("Viewer: Cannot load model references.", e));
|
|
4221
4214
|
for (const file of references) {
|
|
4222
4215
|
await this.client
|
|
4223
4216
|
.downloadFile(file.id, undefined, abortController.signal)
|
|
4224
4217
|
.then((arrayBuffer) => { var _a; return (_a = this.visualizeJs) === null || _a === void 0 ? void 0 : _a.getViewer().addEmbeddedFile(file.name, new Uint8Array(arrayBuffer)); })
|
|
4225
|
-
.catch((e) => console.error(`Cannot load reference file ${file.name}.`, e));
|
|
4218
|
+
.catch((e) => console.error(`Viewer: Cannot load reference file ${file.name}.`, e));
|
|
4226
4219
|
}
|
|
4227
4220
|
return this;
|
|
4228
4221
|
}
|
|
@@ -4283,56 +4276,6 @@ class Viewer extends EventEmitter2 {
|
|
|
4283
4276
|
this.update(true);
|
|
4284
4277
|
return this;
|
|
4285
4278
|
}
|
|
4286
|
-
openVsfFile(buffer) {
|
|
4287
|
-
console.warn("Viewer.openVsfFile() has been deprecated since 26.4 and will be removed in a future release, use Viewer.open() instead.");
|
|
4288
|
-
if (!this.visualizeJs)
|
|
4289
|
-
return this;
|
|
4290
|
-
this.cancel();
|
|
4291
|
-
this.clear();
|
|
4292
|
-
this.emitEvent({ type: "open", mode: "file", file: "", buffer });
|
|
4293
|
-
const visViewer = this.visViewer();
|
|
4294
|
-
this.emitEvent({ type: "geometrystart", file: "", buffer });
|
|
4295
|
-
try {
|
|
4296
|
-
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
4297
|
-
visViewer.parseFile(data);
|
|
4298
|
-
this.syncOptions();
|
|
4299
|
-
this.syncOverlay();
|
|
4300
|
-
this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
|
|
4301
|
-
this.emitEvent({ type: "databasechunk", data, file: "", buffer });
|
|
4302
|
-
}
|
|
4303
|
-
catch (error) {
|
|
4304
|
-
this.emitEvent({ type: "geometryerror", data: error, file: "", buffer });
|
|
4305
|
-
throw error;
|
|
4306
|
-
}
|
|
4307
|
-
this.emitEvent({ type: "geometryend", file: "", buffer });
|
|
4308
|
-
this.update(true);
|
|
4309
|
-
return this;
|
|
4310
|
-
}
|
|
4311
|
-
openVsfxFile(buffer) {
|
|
4312
|
-
console.warn("Viewer.openVsfxFile() has been deprecated since 26.4 and will be removed in a future release, use Viewer.open() instead.");
|
|
4313
|
-
if (!this.visualizeJs)
|
|
4314
|
-
return this;
|
|
4315
|
-
this.cancel();
|
|
4316
|
-
this.clear();
|
|
4317
|
-
this.emitEvent({ type: "open", mode: "file", file: "", buffer });
|
|
4318
|
-
const visViewer = this.visViewer();
|
|
4319
|
-
this.emitEvent({ type: "geometrystart", file: "", buffer });
|
|
4320
|
-
try {
|
|
4321
|
-
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
4322
|
-
visViewer.parseVsfx(data);
|
|
4323
|
-
this.syncOptions();
|
|
4324
|
-
this.syncOverlay();
|
|
4325
|
-
this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
|
|
4326
|
-
this.emitEvent({ type: "databasechunk", data, file: "", buffer });
|
|
4327
|
-
}
|
|
4328
|
-
catch (error) {
|
|
4329
|
-
this.emitEvent({ type: "geometryerror", data: error, file: "", buffer });
|
|
4330
|
-
throw error;
|
|
4331
|
-
}
|
|
4332
|
-
this.emitEvent({ type: "geometryend", file: "", buffer });
|
|
4333
|
-
this.update(true);
|
|
4334
|
-
return this;
|
|
4335
|
-
}
|
|
4336
4279
|
cancel() {
|
|
4337
4280
|
var _a;
|
|
4338
4281
|
(_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
|
|
@@ -4544,15 +4487,10 @@ class Viewer extends EventEmitter2 {
|
|
|
4544
4487
|
collect() {
|
|
4545
4488
|
this.executeCommand("collect");
|
|
4546
4489
|
}
|
|
4547
|
-
registerDragger(name, dragger) {
|
|
4548
|
-
console.warn("Viewer.registerDragger() has been deprecated since 25.12 and will be removed in a future release, use draggers('visualizejs').registerDragger() instead.");
|
|
4549
|
-
draggers.registerDragger(name, (viewer) => new dragger(viewer));
|
|
4550
|
-
}
|
|
4551
4490
|
activeDragger() {
|
|
4552
4491
|
return this._activeDragger;
|
|
4553
4492
|
}
|
|
4554
4493
|
setActiveDragger(name = "") {
|
|
4555
|
-
var _a, _b;
|
|
4556
4494
|
if (!this._activeDragger || this._activeDragger.name !== name) {
|
|
4557
4495
|
const oldDragger = this._activeDragger;
|
|
4558
4496
|
let newDragger = null;
|
|
@@ -4562,10 +4500,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4562
4500
|
}
|
|
4563
4501
|
if (this.visualizeJs) {
|
|
4564
4502
|
newDragger = draggers.createDragger(name, this);
|
|
4565
|
-
|
|
4566
|
-
this._activeDragger = newDragger;
|
|
4567
|
-
(_b = (_a = this._activeDragger).initialize) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4568
|
-
}
|
|
4503
|
+
this._activeDragger = newDragger;
|
|
4569
4504
|
}
|
|
4570
4505
|
const canvas = this.canvas;
|
|
4571
4506
|
if (canvas) {
|
|
@@ -4771,51 +4706,34 @@ class Viewer extends EventEmitter2 {
|
|
|
4771
4706
|
const model = visViewer.getMarkupModel();
|
|
4772
4707
|
const entityId = model.appendEntity(entityName);
|
|
4773
4708
|
const entityPtr = entityId.openObject();
|
|
4774
|
-
const color = this.getMarkupColor();
|
|
4709
|
+
const color = this.markup.getMarkupColor();
|
|
4775
4710
|
entityPtr.setColor(color.r, color.g, color.b);
|
|
4776
4711
|
entityPtr.setLineWeight(2);
|
|
4777
4712
|
entityPtr.delete();
|
|
4778
4713
|
this.update();
|
|
4779
4714
|
return entityId;
|
|
4780
4715
|
}
|
|
4781
|
-
getMarkupColor() {
|
|
4782
|
-
console.warn("Viewer.getMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.getMarkupColor() instead.");
|
|
4783
|
-
return this._markup.getMarkupColor();
|
|
4784
|
-
}
|
|
4785
|
-
setMarkupColor(r = 255, g = 0, b = 0) {
|
|
4786
|
-
console.warn("Viewer.setMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.setMarkupColor() instead.");
|
|
4787
|
-
this._markup.setMarkupColor(r, g, b);
|
|
4788
|
-
}
|
|
4789
|
-
colorizeAllMarkup(r = 255, g = 0, b = 0) {
|
|
4790
|
-
console.warn("Viewer.colorizeAllMarkup() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.colorizeAllMarkup() instead.");
|
|
4791
|
-
this._markup.colorizeAllMarkup(r, g, b);
|
|
4792
|
-
}
|
|
4793
|
-
colorizeSelectedMarkups(r = 255, g = 0, b = 0) {
|
|
4794
|
-
this._markup.colorizeSelectedMarkups(r, g, b);
|
|
4795
|
-
}
|
|
4796
4716
|
scheduleUpdateAsync(maxScheduleUpdateTimeInMs = 50) {
|
|
4797
4717
|
return new Promise((resolve, reject) => {
|
|
4798
4718
|
setTimeout(() => {
|
|
4799
|
-
|
|
4719
|
+
this._maxRegenTime = maxScheduleUpdateTimeInMs;
|
|
4800
4720
|
try {
|
|
4801
|
-
|
|
4802
|
-
(_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update(maxScheduleUpdateTimeInMs);
|
|
4803
|
-
(_c = (_b = this._activeDragger) === null || _b === void 0 ? void 0 : _b.updatePreview) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4804
|
-
}
|
|
4805
|
-
this.emitEvent({ type: "update", force: false });
|
|
4721
|
+
this.update(true);
|
|
4806
4722
|
resolve();
|
|
4807
4723
|
}
|
|
4808
4724
|
catch (e) {
|
|
4809
|
-
console.error(e);
|
|
4725
|
+
console.error("Viewer: Async update error.", e);
|
|
4810
4726
|
reject();
|
|
4811
4727
|
}
|
|
4728
|
+
finally {
|
|
4729
|
+
this._maxRegenTime = 0;
|
|
4730
|
+
}
|
|
4812
4731
|
}, 0);
|
|
4813
4732
|
});
|
|
4814
4733
|
}
|
|
4815
4734
|
async updateAsync(maxScheduleUpdateTimeInMs = 50, maxScheduleUpdateCount = 50) {
|
|
4816
4735
|
if (!this.visualizeJs)
|
|
4817
4736
|
return;
|
|
4818
|
-
this._isRunAsyncUpdate = true;
|
|
4819
4737
|
try {
|
|
4820
4738
|
const device = this.visViewer().getActiveDevice();
|
|
4821
4739
|
for (let iterationCount = 0; !device.isValid() && iterationCount < maxScheduleUpdateCount; iterationCount++) {
|
|
@@ -4824,10 +4742,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4824
4742
|
await this.scheduleUpdateAsync(maxScheduleUpdateTimeInMs);
|
|
4825
4743
|
}
|
|
4826
4744
|
catch (e) {
|
|
4827
|
-
console.error(e);
|
|
4828
|
-
}
|
|
4829
|
-
finally {
|
|
4830
|
-
this._isRunAsyncUpdate = false;
|
|
4745
|
+
console.error("Viewer: Async update error.", e);
|
|
4831
4746
|
}
|
|
4832
4747
|
}
|
|
4833
4748
|
deviceAutoRegeneration() {
|