@inweb/viewer-visualize 27.1.6 → 27.1.8
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 +221 -300
- 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
package/dist/viewer-visualize.js
CHANGED
|
@@ -264,10 +264,6 @@
|
|
|
264
264
|
static defaults() {
|
|
265
265
|
return defaultOptions();
|
|
266
266
|
}
|
|
267
|
-
notifierChangeEvent() {
|
|
268
|
-
console.warn("Options.notifierChangeEvent() has been deprecated since 25.3 and will be removed in a future release, use Options.change() instead.");
|
|
269
|
-
this.change();
|
|
270
|
-
}
|
|
271
267
|
change() {
|
|
272
268
|
if (this._emitter !== undefined) {
|
|
273
269
|
this.saveToStorage();
|
|
@@ -709,17 +705,27 @@
|
|
|
709
705
|
this.needInputText = false;
|
|
710
706
|
this.mouseDownPosition = { x: 0, y: 0 };
|
|
711
707
|
this.autoSelect = false;
|
|
712
|
-
this.
|
|
713
|
-
this.
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
this.
|
|
717
|
-
this.
|
|
718
|
-
this.
|
|
719
|
-
this.
|
|
708
|
+
this.pointerdown = this.pointerdown.bind(this);
|
|
709
|
+
this.pointerup = this.pointerup.bind(this);
|
|
710
|
+
this.pointercancel = this.pointercancel.bind(this);
|
|
711
|
+
this.pointermove = this.pointermove.bind(this);
|
|
712
|
+
this.click = this.click.bind(this);
|
|
713
|
+
this.dblclick = this.dblclick.bind(this);
|
|
714
|
+
this.subject.addEventListener("pointerdown", this.pointerdown);
|
|
715
|
+
this.subject.addEventListener("pointerup", this.pointerup);
|
|
716
|
+
this.subject.addEventListener("pointercancel", this.pointercancel);
|
|
717
|
+
this.subject.addEventListener("pointermove", this.pointermove);
|
|
718
|
+
this.subject.addEventListener("click", this.click);
|
|
719
|
+
this.subject.addEventListener("dblclick", this.dblclick);
|
|
720
|
+
this.getViewer().setEnableAutoSelect(false);
|
|
720
721
|
}
|
|
721
722
|
dispose() {
|
|
722
|
-
this.
|
|
723
|
+
this.subject.removeEventListener("pointerdown", this.pointerdown);
|
|
724
|
+
this.subject.removeEventListener("pointerup", this.pointerup);
|
|
725
|
+
this.subject.removeEventListener("pointercancel", this.pointercancel);
|
|
726
|
+
this.subject.removeEventListener("pointermove", this.pointermove);
|
|
727
|
+
this.subject.removeEventListener("click", this.click);
|
|
728
|
+
this.subject.removeEventListener("dblclick", this.dblclick);
|
|
723
729
|
}
|
|
724
730
|
relativeCoords(event) {
|
|
725
731
|
return { x: event.offsetX * window.devicePixelRatio, y: event.offsetY * window.devicePixelRatio };
|
|
@@ -770,13 +776,13 @@
|
|
|
770
776
|
const x = relCoord.x;
|
|
771
777
|
const y = relCoord.y;
|
|
772
778
|
const isNotDragging = Math.abs(x - this.mouseDownPosition.x) < CLICK_DELTA && Math.abs(y - this.mouseDownPosition.y) < CLICK_DELTA;
|
|
773
|
-
if (
|
|
779
|
+
if (this.autoSelect && isNotDragging) {
|
|
774
780
|
viewer.unselect();
|
|
775
781
|
viewer.select(x, y, x, y);
|
|
776
782
|
this.subject.update();
|
|
777
783
|
const selectionSet = viewer.getSelected();
|
|
778
|
-
this.
|
|
779
|
-
this.
|
|
784
|
+
this.subject.emitEvent({ type: "select", data: selectionSet, handles: this.subject.getSelected() });
|
|
785
|
+
this.subject.emitEvent({ type: "select2", data: selectionSet, handles: this.subject.getSelected2() });
|
|
780
786
|
}
|
|
781
787
|
}
|
|
782
788
|
dblclick(ev) {
|
|
@@ -791,17 +797,15 @@
|
|
|
791
797
|
clickView.delete();
|
|
792
798
|
this.subject.update();
|
|
793
799
|
}
|
|
794
|
-
else {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
this.deleteAll([itr, entity]);
|
|
804
|
-
}
|
|
800
|
+
else if (this.autoSelect) {
|
|
801
|
+
const pSelected = viewer.getSelected();
|
|
802
|
+
if (!pSelected.isNull() && pSelected.numItems() !== 0) {
|
|
803
|
+
const itr = pSelected.getIterator();
|
|
804
|
+
const entity = itr.getEntity();
|
|
805
|
+
viewer.zoomToEntity(entity);
|
|
806
|
+
this.subject.emitEvent({ type: "zoomtoentity", data: entity });
|
|
807
|
+
this.subject.update();
|
|
808
|
+
this.deleteAll([itr, entity]);
|
|
805
809
|
}
|
|
806
810
|
}
|
|
807
811
|
device.delete();
|
|
@@ -821,7 +825,6 @@
|
|
|
821
825
|
(_a = obj === null || obj === void 0 ? void 0 : obj.delete) === null || _a === void 0 ? void 0 : _a.call(obj);
|
|
822
826
|
}
|
|
823
827
|
}
|
|
824
|
-
updatePreview() { }
|
|
825
828
|
static set isGestureActive(value) {
|
|
826
829
|
if (OdBaseDragger._isGestureActive === value) {
|
|
827
830
|
return;
|
|
@@ -1199,23 +1202,23 @@
|
|
|
1199
1202
|
this.rulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
1200
1203
|
this.rulerPrecision = (_b = subject.options.rulerPrecision) !== null && _b !== void 0 ? _b : "Default";
|
|
1201
1204
|
this.items = [];
|
|
1202
|
-
this.canvasEvents.push("resize", "optionsChange");
|
|
1203
|
-
}
|
|
1204
|
-
initialize() {
|
|
1205
|
-
super.initialize();
|
|
1206
1205
|
this.m_overlayElement = document.createElement("div");
|
|
1207
1206
|
this.m_overlayElement.style.background = "rgba(0,0,0,0)";
|
|
1208
1207
|
this.m_overlayElement.style.position = "fixed";
|
|
1209
1208
|
this.m_overlayElement.style.zIndex = "1";
|
|
1210
1209
|
this.m_overlayElement.style.pointerEvents = "none";
|
|
1211
1210
|
document.body.appendChild(this.m_overlayElement);
|
|
1211
|
+
this.optionsChange = this.optionsChange.bind(this);
|
|
1212
|
+
this.updatePreview = this.updatePreview.bind(this);
|
|
1212
1213
|
this.subject.addEventListener("optionschange", this.optionsChange);
|
|
1214
|
+
this.subject.addEventListener("render", this.updatePreview);
|
|
1213
1215
|
this.resize();
|
|
1214
1216
|
}
|
|
1215
1217
|
dispose() {
|
|
1216
1218
|
super.dispose();
|
|
1217
1219
|
this.m_overlayElement.remove();
|
|
1218
1220
|
this.subject.removeEventListener("optionschange", this.optionsChange);
|
|
1221
|
+
this.subject.removeEventListener("render", this.updatePreview);
|
|
1219
1222
|
}
|
|
1220
1223
|
updatePreview() {
|
|
1221
1224
|
this.items.forEach((item) => item.update());
|
|
@@ -1556,7 +1559,6 @@
|
|
|
1556
1559
|
class OdaWalkDragger extends OdBaseDragger {
|
|
1557
1560
|
constructor(subject) {
|
|
1558
1561
|
super(subject);
|
|
1559
|
-
this.viewer = undefined;
|
|
1560
1562
|
this.multiplier = 5;
|
|
1561
1563
|
this.baseSpeed = 1;
|
|
1562
1564
|
this.keyPressMap = new Set();
|
|
@@ -1571,9 +1573,6 @@
|
|
|
1571
1573
|
this.autoSelect = true;
|
|
1572
1574
|
this.isJoyStickMoving = false;
|
|
1573
1575
|
this.addJoyStickDragger(subject.canvas.parentElement);
|
|
1574
|
-
}
|
|
1575
|
-
initialize() {
|
|
1576
|
-
super.initialize();
|
|
1577
1576
|
this.viewer = this.getViewer();
|
|
1578
1577
|
window.addEventListener("keydown", this.keydown, false);
|
|
1579
1578
|
window.addEventListener("keyup", this.keyup, false);
|
|
@@ -1836,7 +1835,6 @@
|
|
|
1836
1835
|
class OdaFlyDragger extends OdBaseDragger {
|
|
1837
1836
|
constructor(subject) {
|
|
1838
1837
|
super(subject);
|
|
1839
|
-
this.viewer = undefined;
|
|
1840
1838
|
this.multiplier = 5;
|
|
1841
1839
|
this.speed = 1;
|
|
1842
1840
|
this.keyPressMap = new Set();
|
|
@@ -1851,9 +1849,6 @@
|
|
|
1851
1849
|
this.autoSelect = true;
|
|
1852
1850
|
this.isJoyStickMoving = false;
|
|
1853
1851
|
this.addJoyStickDragger(subject.canvas.parentElement);
|
|
1854
|
-
}
|
|
1855
|
-
initialize() {
|
|
1856
|
-
super.initialize();
|
|
1857
1852
|
this.viewer = this.getViewer();
|
|
1858
1853
|
window.addEventListener("keydown", this.keydown, false);
|
|
1859
1854
|
window.addEventListener("keyup", this.keyup, false);
|
|
@@ -2292,7 +2287,6 @@
|
|
|
2292
2287
|
this._beginInteractivity();
|
|
2293
2288
|
}
|
|
2294
2289
|
action(x, y) {
|
|
2295
|
-
var _a, _b;
|
|
2296
2290
|
const view = this.getViewer().activeView;
|
|
2297
2291
|
const corners = view.vportRect;
|
|
2298
2292
|
const size = Math.max(Math.abs(corners[2] - corners[0]), Math.abs(corners[3] - corners[1]));
|
|
@@ -2322,7 +2316,7 @@
|
|
|
2322
2316
|
const extView = this.getViewer().getActiveTvExtendedView();
|
|
2323
2317
|
extView.setView(viewParams.position, viewParams.target, viewParams.upVector, viewParams.viewFieldWidth, viewParams.viewFieldHeight, viewParams.perspective);
|
|
2324
2318
|
extView.delete();
|
|
2325
|
-
|
|
2319
|
+
this._subject.update();
|
|
2326
2320
|
this._subject.emitEvent({
|
|
2327
2321
|
type: "orbit",
|
|
2328
2322
|
});
|
|
@@ -2509,7 +2503,6 @@
|
|
|
2509
2503
|
this._beginInteractivity();
|
|
2510
2504
|
}
|
|
2511
2505
|
action(x, y, absoluteX, absoluteY) {
|
|
2512
|
-
var _a, _b;
|
|
2513
2506
|
const { Vector3d } = this._m_module;
|
|
2514
2507
|
const params = this._getViewParams();
|
|
2515
2508
|
const pt = this.screenToWorld(x, y);
|
|
@@ -2526,7 +2519,7 @@
|
|
|
2526
2519
|
targetWithDelta.delete();
|
|
2527
2520
|
position.delete();
|
|
2528
2521
|
positionWithDelta.delete();
|
|
2529
|
-
|
|
2522
|
+
this._subject.update();
|
|
2530
2523
|
this._subject.emitEvent({
|
|
2531
2524
|
type: "pan",
|
|
2532
2525
|
x: absoluteX,
|
|
@@ -2575,11 +2568,10 @@
|
|
|
2575
2568
|
this._subject = subject;
|
|
2576
2569
|
}
|
|
2577
2570
|
action(x, y, zoomFactor, absoluteX, absoluteY) {
|
|
2578
|
-
var _a, _b;
|
|
2579
2571
|
const viewer = this._m_module.getViewer();
|
|
2580
2572
|
viewer.zoomAt(zoomFactor, x, y);
|
|
2581
2573
|
this._subject.deviceAutoRegeneration();
|
|
2582
|
-
|
|
2574
|
+
this._subject.update();
|
|
2583
2575
|
this._subject.emitEvent({
|
|
2584
2576
|
type: "zoomat",
|
|
2585
2577
|
data: zoomFactor,
|
|
@@ -2627,11 +2619,27 @@
|
|
|
2627
2619
|
class OdZoomWheelDragger extends OdBaseDragger {
|
|
2628
2620
|
constructor(subject) {
|
|
2629
2621
|
super(subject);
|
|
2630
|
-
this.
|
|
2622
|
+
this.wheel = this.wheel.bind(this);
|
|
2623
|
+
this.subject.addEventListener("wheel", this.wheel);
|
|
2631
2624
|
this._zoomAction = new ZoomAction(this.m_module, this.subject);
|
|
2632
2625
|
this._endInteractivityTimeOutId = undefined;
|
|
2633
2626
|
this._isEnableInteractivityMode = false;
|
|
2634
2627
|
}
|
|
2628
|
+
dispose() {
|
|
2629
|
+
super.dispose();
|
|
2630
|
+
this.subject.removeEventListener("wheel", this.wheel);
|
|
2631
|
+
if (this._endInteractivityTimeOutId) {
|
|
2632
|
+
clearTimeout(this._endInteractivityTimeOutId);
|
|
2633
|
+
this.endInteractivity();
|
|
2634
|
+
this._isEnableInteractivityMode = false;
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
pointerdown() { }
|
|
2638
|
+
pointerup() { }
|
|
2639
|
+
pointercancel() { }
|
|
2640
|
+
pointermove() { }
|
|
2641
|
+
click() { }
|
|
2642
|
+
dblclick() { }
|
|
2635
2643
|
wheel(event) {
|
|
2636
2644
|
if (!this.subject.options.enableZoomWheel) {
|
|
2637
2645
|
return;
|
|
@@ -2651,13 +2659,6 @@
|
|
|
2651
2659
|
if (this._endInteractivityTimeOutId) {
|
|
2652
2660
|
clearTimeout(this._endInteractivityTimeOutId);
|
|
2653
2661
|
}
|
|
2654
|
-
if (!this._isEnableInteractivityMode) {
|
|
2655
|
-
this._isEnableInteractivityMode = true;
|
|
2656
|
-
this.beginInteractivity();
|
|
2657
|
-
}
|
|
2658
|
-
if (this._endInteractivityTimeOutId) {
|
|
2659
|
-
clearTimeout(this._endInteractivityTimeOutId);
|
|
2660
|
-
}
|
|
2661
2662
|
this.subject.update(true);
|
|
2662
2663
|
this._endInteractivityTimeOutId = setTimeout(() => {
|
|
2663
2664
|
this._endInteractivityTimeOutId = undefined;
|
|
@@ -2666,13 +2667,6 @@
|
|
|
2666
2667
|
}, INTERACTIVITY_TIME_OUT);
|
|
2667
2668
|
}
|
|
2668
2669
|
}
|
|
2669
|
-
dispose() {
|
|
2670
|
-
if (this._endInteractivityTimeOutId) {
|
|
2671
|
-
clearTimeout(this._endInteractivityTimeOutId);
|
|
2672
|
-
this.endInteractivity();
|
|
2673
|
-
this._isEnableInteractivityMode = false;
|
|
2674
|
-
}
|
|
2675
|
-
}
|
|
2676
2670
|
}
|
|
2677
2671
|
|
|
2678
2672
|
class OdSelectionFrame {
|
|
@@ -2892,6 +2886,127 @@
|
|
|
2892
2886
|
}
|
|
2893
2887
|
}
|
|
2894
2888
|
|
|
2889
|
+
const MARKUP_ENTITY_LINE = "$MarkupTempEntity_Line";
|
|
2890
|
+
class OdaLineDragger extends OdBaseDragger {
|
|
2891
|
+
constructor(subject) {
|
|
2892
|
+
super(subject);
|
|
2893
|
+
this.press = false;
|
|
2894
|
+
}
|
|
2895
|
+
dispose() {
|
|
2896
|
+
super.dispose();
|
|
2897
|
+
this.end();
|
|
2898
|
+
this.points = null;
|
|
2899
|
+
this.drawPoints = null;
|
|
2900
|
+
}
|
|
2901
|
+
start(x, y) {
|
|
2902
|
+
const point = this.getViewer().screenToWorld(x, y);
|
|
2903
|
+
this.drawPoints = [point[0], point[1], point[2]];
|
|
2904
|
+
}
|
|
2905
|
+
drag(x, y) {
|
|
2906
|
+
if (this.isDragging) {
|
|
2907
|
+
const point = this.getViewer().screenToWorld(x, y);
|
|
2908
|
+
this.drawPoints.push(point[0], point[1], point[2]);
|
|
2909
|
+
this._updateFrame();
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
end() {
|
|
2913
|
+
if (this.entity) {
|
|
2914
|
+
this.entity.delete();
|
|
2915
|
+
this.drawPoints = null;
|
|
2916
|
+
this.entity = null;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
_updateFrame() {
|
|
2920
|
+
if (this.entity) {
|
|
2921
|
+
const model = this.getViewer().getMarkupModel();
|
|
2922
|
+
model.removeEntity(this.entity);
|
|
2923
|
+
model.delete();
|
|
2924
|
+
this.entity.delete();
|
|
2925
|
+
}
|
|
2926
|
+
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_LINE);
|
|
2927
|
+
const entityPtr = this.entity.openObject();
|
|
2928
|
+
entityPtr.appendPolyline(this.drawPoints).delete();
|
|
2929
|
+
entityPtr.delete();
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
const MARKUP_ENTITY_TEXT = "$MarkupTempEntity_Text";
|
|
2934
|
+
class OdaTextDragger extends OdBaseDragger {
|
|
2935
|
+
constructor(subject) {
|
|
2936
|
+
super(subject);
|
|
2937
|
+
this.TEXT_HEIGHT_ALIGN = 24;
|
|
2938
|
+
this.press = false;
|
|
2939
|
+
}
|
|
2940
|
+
dispose() {
|
|
2941
|
+
var _a;
|
|
2942
|
+
super.dispose();
|
|
2943
|
+
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2944
|
+
this.textRef = null;
|
|
2945
|
+
}
|
|
2946
|
+
_finishInput() {
|
|
2947
|
+
var _a;
|
|
2948
|
+
if (this.textRef && this.textRef.value.trimLeft()) {
|
|
2949
|
+
this._updateFrame();
|
|
2950
|
+
}
|
|
2951
|
+
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
2952
|
+
this.textRef = null;
|
|
2953
|
+
}
|
|
2954
|
+
start(x, y, absoluteX, absoluteY) {
|
|
2955
|
+
if (!this.textRef) {
|
|
2956
|
+
this.textRef = document.createElement("textarea");
|
|
2957
|
+
this.textRef.style.zIndex = "9999";
|
|
2958
|
+
this.textRef.style.position = "absolute";
|
|
2959
|
+
this.textRef.style.display = "block";
|
|
2960
|
+
this.textRef.style.top = absoluteY + "px";
|
|
2961
|
+
this.textRef.style.left = absoluteX + "px";
|
|
2962
|
+
this.textRef.onkeypress = (event) => {
|
|
2963
|
+
if (event.key === "Enter") {
|
|
2964
|
+
event.preventDefault();
|
|
2965
|
+
this._finishInput();
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
document.body.appendChild(this.textRef);
|
|
2969
|
+
this.press = true;
|
|
2970
|
+
this.m_center = this.screenToWorld(x, y + this.TEXT_HEIGHT_ALIGN);
|
|
2971
|
+
this.needInputText = true;
|
|
2972
|
+
}
|
|
2973
|
+
else {
|
|
2974
|
+
this._finishInput();
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
_updateFrame() {
|
|
2978
|
+
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_TEXT);
|
|
2979
|
+
const entityPtr = this.entity.openObject();
|
|
2980
|
+
const view = this.getViewer().activeView;
|
|
2981
|
+
const pos = this.toPoint(view.viewPosition);
|
|
2982
|
+
const target = this.toPoint(view.viewTarget);
|
|
2983
|
+
const eyeToWorld = view.eyeToWorldMatrix;
|
|
2984
|
+
const eyeDir = pos.sub(target).asVector();
|
|
2985
|
+
const xDir = this.toVector([1.0, 0.0, 0.0]);
|
|
2986
|
+
const direction = xDir.transformBy(eyeToWorld);
|
|
2987
|
+
const mtrx = this.createMatrix3d();
|
|
2988
|
+
mtrx.setToWorldToPlane(this.toGeVector(eyeDir));
|
|
2989
|
+
direction.transformBy(mtrx);
|
|
2990
|
+
const angel = -Math.atan2(-direction.y, direction.x);
|
|
2991
|
+
const textSize = 0.02;
|
|
2992
|
+
let textScale = 1.0;
|
|
2993
|
+
const projMtrx = view.projectionMatrix;
|
|
2994
|
+
const mtrxNumber = projMtrx.get(1, 1);
|
|
2995
|
+
const tol = 1.0e-6;
|
|
2996
|
+
if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
|
|
2997
|
+
textScale = 1 / mtrxNumber;
|
|
2998
|
+
}
|
|
2999
|
+
const geomData = entityPtr.appendText(this.toGePoint(this.m_center), this.textRef.value.trimLeft());
|
|
3000
|
+
const textPtr = geomData.openAsText();
|
|
3001
|
+
textPtr.setNormal(this.toGeVector(eyeDir));
|
|
3002
|
+
textPtr.setRotation(angel);
|
|
3003
|
+
textPtr.setTextSize(textSize * textScale);
|
|
3004
|
+
textPtr.delete();
|
|
3005
|
+
geomData.delete();
|
|
3006
|
+
entityPtr.delete();
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
|
|
2895
3010
|
const draggers = draggersRegistry("visualizejs");
|
|
2896
3011
|
draggers.registerDragger("Pan", (viewer) => new OdPanDragger(viewer));
|
|
2897
3012
|
draggers.registerDragger("Orbit", (viewer) => new OdOrbitDragger(viewer));
|
|
@@ -2905,6 +3020,8 @@
|
|
|
2905
3020
|
draggers.registerDragger("CuttingPlaneZAxis", (viewer) => new OdCuttingPlaneZAxisDragger(viewer));
|
|
2906
3021
|
draggers.registerDragger("Walk", (viewer) => new OdaWalkDragger(viewer));
|
|
2907
3022
|
draggers.registerDragger("Fly", (viewer) => new OdaFlyDragger(viewer));
|
|
3023
|
+
draggers.registerDragger("Line", (viewer) => new OdaLineDragger(viewer));
|
|
3024
|
+
draggers.registerDragger("Text", (viewer) => new OdaTextDragger(viewer));
|
|
2908
3025
|
|
|
2909
3026
|
const composeMatrixFromTransform = (transform, modelCenter, visLib) => {
|
|
2910
3027
|
const { translate, scale, rotation } = transform;
|
|
@@ -3501,10 +3618,8 @@
|
|
|
3501
3618
|
|
|
3502
3619
|
class ZoomWheelComponent {
|
|
3503
3620
|
constructor(viewer) {
|
|
3504
|
-
this.viewer = viewer;
|
|
3505
3621
|
this.zoomWheelDragger = new OdZoomWheelDragger(viewer);
|
|
3506
3622
|
this.zoomWheelDragger.name = "ZoomWheel";
|
|
3507
|
-
this.zoomWheelDragger.initialize();
|
|
3508
3623
|
}
|
|
3509
3624
|
dispose() {
|
|
3510
3625
|
this.zoomWheelDragger.dispose();
|
|
@@ -3536,6 +3651,12 @@
|
|
|
3536
3651
|
this._orbitAction = new OrbitAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity);
|
|
3537
3652
|
this._panAction = new PanAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity, this.getViewParams, this.setViewParams);
|
|
3538
3653
|
this._zoomAction = new ZoomAction(this.m_module, this.subject);
|
|
3654
|
+
this.pointerleave = this.pointerleave.bind(this);
|
|
3655
|
+
this.subject.addEventListener("pointerleave", this.pointerleave);
|
|
3656
|
+
}
|
|
3657
|
+
dispose() {
|
|
3658
|
+
super.dispose();
|
|
3659
|
+
this.subject.removeEventListener("pointerleave", this.pointerleave);
|
|
3539
3660
|
}
|
|
3540
3661
|
getMiddlePoint(events) {
|
|
3541
3662
|
if (events.size !== 2) {
|
|
@@ -3692,9 +3813,7 @@
|
|
|
3692
3813
|
|
|
3693
3814
|
class GestureManagerComponent {
|
|
3694
3815
|
constructor(viewer) {
|
|
3695
|
-
this.viewer = viewer;
|
|
3696
3816
|
this.gestureManager = new GestureManager(viewer);
|
|
3697
|
-
this.gestureManager.initialize();
|
|
3698
3817
|
}
|
|
3699
3818
|
dispose() {
|
|
3700
3819
|
this.gestureManager.dispose();
|
|
@@ -17314,8 +17433,18 @@ js: import "konva/skia-backend";
|
|
|
17314
17433
|
getSelectedObjects() {
|
|
17315
17434
|
if (!this._konvaTransformer)
|
|
17316
17435
|
return [];
|
|
17317
|
-
|
|
17318
|
-
|
|
17436
|
+
const validNodes = this._konvaTransformer.nodes().filter((ref) => {
|
|
17437
|
+
try {
|
|
17438
|
+
return ref.getLayer() !== null && ref.getParent() !== null;
|
|
17439
|
+
}
|
|
17440
|
+
catch {
|
|
17441
|
+
return false;
|
|
17442
|
+
}
|
|
17443
|
+
});
|
|
17444
|
+
if (validNodes.length !== this._konvaTransformer.nodes().length) {
|
|
17445
|
+
this._konvaTransformer.nodes(validNodes);
|
|
17446
|
+
}
|
|
17447
|
+
return validNodes
|
|
17319
17448
|
.map((ref) => {
|
|
17320
17449
|
const name = ref.className;
|
|
17321
17450
|
const konvaShape = Object.values(MarkupMode2Konva).find((shape) => shape.name === name);
|
|
@@ -17919,127 +18048,6 @@ js: import "konva/skia-backend";
|
|
|
17919
18048
|
}
|
|
17920
18049
|
}
|
|
17921
18050
|
|
|
17922
|
-
const MARKUP_ENTITY_LINE = "$MarkupTempEntity_Line";
|
|
17923
|
-
class OdaLineDragger extends OdBaseDragger {
|
|
17924
|
-
constructor(subject) {
|
|
17925
|
-
super(subject);
|
|
17926
|
-
this.press = false;
|
|
17927
|
-
}
|
|
17928
|
-
dispose() {
|
|
17929
|
-
super.dispose();
|
|
17930
|
-
this.end();
|
|
17931
|
-
this.points = null;
|
|
17932
|
-
this.drawPoints = null;
|
|
17933
|
-
}
|
|
17934
|
-
start(x, y) {
|
|
17935
|
-
const point = this.getViewer().screenToWorld(x, y);
|
|
17936
|
-
this.drawPoints = [point[0], point[1], point[2]];
|
|
17937
|
-
}
|
|
17938
|
-
drag(x, y) {
|
|
17939
|
-
if (this.isDragging) {
|
|
17940
|
-
const point = this.getViewer().screenToWorld(x, y);
|
|
17941
|
-
this.drawPoints.push(point[0], point[1], point[2]);
|
|
17942
|
-
this._updateFrame();
|
|
17943
|
-
}
|
|
17944
|
-
}
|
|
17945
|
-
end() {
|
|
17946
|
-
if (this.entity) {
|
|
17947
|
-
this.entity.delete();
|
|
17948
|
-
this.drawPoints = null;
|
|
17949
|
-
this.entity = null;
|
|
17950
|
-
}
|
|
17951
|
-
}
|
|
17952
|
-
_updateFrame() {
|
|
17953
|
-
if (this.entity) {
|
|
17954
|
-
const model = this.getViewer().getMarkupModel();
|
|
17955
|
-
model.removeEntity(this.entity);
|
|
17956
|
-
model.delete();
|
|
17957
|
-
this.entity.delete();
|
|
17958
|
-
}
|
|
17959
|
-
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_LINE);
|
|
17960
|
-
const entityPtr = this.entity.openObject();
|
|
17961
|
-
entityPtr.appendPolyline(this.drawPoints).delete();
|
|
17962
|
-
entityPtr.delete();
|
|
17963
|
-
}
|
|
17964
|
-
}
|
|
17965
|
-
|
|
17966
|
-
const MARKUP_ENTITY_TEXT = "$MarkupTempEntity_Text";
|
|
17967
|
-
class OdaTextDragger extends OdBaseDragger {
|
|
17968
|
-
constructor(subject) {
|
|
17969
|
-
super(subject);
|
|
17970
|
-
this.TEXT_HEIGHT_ALIGN = 24;
|
|
17971
|
-
this.press = false;
|
|
17972
|
-
}
|
|
17973
|
-
dispose() {
|
|
17974
|
-
var _a;
|
|
17975
|
-
super.dispose();
|
|
17976
|
-
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
17977
|
-
this.textRef = null;
|
|
17978
|
-
}
|
|
17979
|
-
_finishInput() {
|
|
17980
|
-
var _a;
|
|
17981
|
-
if (this.textRef && this.textRef.value.trimLeft()) {
|
|
17982
|
-
this._updateFrame();
|
|
17983
|
-
}
|
|
17984
|
-
(_a = this.textRef) === null || _a === void 0 ? void 0 : _a.remove();
|
|
17985
|
-
this.textRef = null;
|
|
17986
|
-
}
|
|
17987
|
-
start(x, y, absoluteX, absoluteY) {
|
|
17988
|
-
if (!this.textRef) {
|
|
17989
|
-
this.textRef = document.createElement("textarea");
|
|
17990
|
-
this.textRef.style.zIndex = "9999";
|
|
17991
|
-
this.textRef.style.position = "absolute";
|
|
17992
|
-
this.textRef.style.display = "block";
|
|
17993
|
-
this.textRef.style.top = absoluteY + "px";
|
|
17994
|
-
this.textRef.style.left = absoluteX + "px";
|
|
17995
|
-
this.textRef.onkeypress = (event) => {
|
|
17996
|
-
if (event.key === "Enter") {
|
|
17997
|
-
event.preventDefault();
|
|
17998
|
-
this._finishInput();
|
|
17999
|
-
}
|
|
18000
|
-
};
|
|
18001
|
-
document.body.appendChild(this.textRef);
|
|
18002
|
-
this.press = true;
|
|
18003
|
-
this.m_center = this.screenToWorld(x, y + this.TEXT_HEIGHT_ALIGN);
|
|
18004
|
-
this.needInputText = true;
|
|
18005
|
-
}
|
|
18006
|
-
else {
|
|
18007
|
-
this._finishInput();
|
|
18008
|
-
}
|
|
18009
|
-
}
|
|
18010
|
-
_updateFrame() {
|
|
18011
|
-
this.entity = this.getActiveMarkupEntity(MARKUP_ENTITY_TEXT);
|
|
18012
|
-
const entityPtr = this.entity.openObject();
|
|
18013
|
-
const view = this.getViewer().activeView;
|
|
18014
|
-
const pos = this.toPoint(view.viewPosition);
|
|
18015
|
-
const target = this.toPoint(view.viewTarget);
|
|
18016
|
-
const eyeToWorld = view.eyeToWorldMatrix;
|
|
18017
|
-
const eyeDir = pos.sub(target).asVector();
|
|
18018
|
-
const xDir = this.toVector([1.0, 0.0, 0.0]);
|
|
18019
|
-
const direction = xDir.transformBy(eyeToWorld);
|
|
18020
|
-
const mtrx = this.createMatrix3d();
|
|
18021
|
-
mtrx.setToWorldToPlane(this.toGeVector(eyeDir));
|
|
18022
|
-
direction.transformBy(mtrx);
|
|
18023
|
-
const angel = -Math.atan2(-direction.y, direction.x);
|
|
18024
|
-
const textSize = 0.02;
|
|
18025
|
-
let textScale = 1.0;
|
|
18026
|
-
const projMtrx = view.projectionMatrix;
|
|
18027
|
-
const mtrxNumber = projMtrx.get(1, 1);
|
|
18028
|
-
const tol = 1.0e-6;
|
|
18029
|
-
if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
|
|
18030
|
-
textScale = 1 / mtrxNumber;
|
|
18031
|
-
}
|
|
18032
|
-
const geomData = entityPtr.appendText(this.toGePoint(this.m_center), this.textRef.value.trimLeft());
|
|
18033
|
-
const textPtr = geomData.openAsText();
|
|
18034
|
-
textPtr.setNormal(this.toGeVector(eyeDir));
|
|
18035
|
-
textPtr.setRotation(angel);
|
|
18036
|
-
textPtr.setTextSize(textSize * textScale);
|
|
18037
|
-
textPtr.delete();
|
|
18038
|
-
geomData.delete();
|
|
18039
|
-
entityPtr.delete();
|
|
18040
|
-
}
|
|
18041
|
-
}
|
|
18042
|
-
|
|
18043
18051
|
class VisualizeMarkup {
|
|
18044
18052
|
constructor() {
|
|
18045
18053
|
this._markupColor = { r: 255, g: 0, b: 0 };
|
|
@@ -18048,8 +18056,6 @@ js: import "konva/skia-backend";
|
|
|
18048
18056
|
}
|
|
18049
18057
|
initialize(container, containerEvents, viewer, worldTransformer) {
|
|
18050
18058
|
this._viewer = viewer;
|
|
18051
|
-
this._viewer.registerDragger("Line", OdaLineDragger);
|
|
18052
|
-
this._viewer.registerDragger("Text", OdaTextDragger);
|
|
18053
18059
|
}
|
|
18054
18060
|
dispose() { }
|
|
18055
18061
|
syncOverlay() { }
|
|
@@ -18088,7 +18094,7 @@ js: import "konva/skia-backend";
|
|
|
18088
18094
|
this._viewer.update();
|
|
18089
18095
|
}
|
|
18090
18096
|
colorizeSelectedMarkups(r = 255, g = 0, b = 0) {
|
|
18091
|
-
|
|
18097
|
+
console.warn("VisualizeMarkup: colorizeSelectedMarkups() not implemented yet");
|
|
18092
18098
|
}
|
|
18093
18099
|
setViewpoint(viewpoint) {
|
|
18094
18100
|
function getLogicalPoint3dAsArray(point3d) {
|
|
@@ -18198,19 +18204,28 @@ js: import "konva/skia-backend";
|
|
|
18198
18204
|
return ((_a = visLib.canvas) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality)) || "";
|
|
18199
18205
|
}
|
|
18200
18206
|
enableEditMode(mode) {
|
|
18207
|
+
if (mode === "Line" || mode === "Text")
|
|
18208
|
+
this._viewer.setActiveDragger(mode);
|
|
18201
18209
|
return this;
|
|
18202
18210
|
}
|
|
18203
18211
|
createObject(type, params) {
|
|
18212
|
+
console.warn("VisualizeMarkup: createObject() not implemented yet");
|
|
18204
18213
|
return undefined;
|
|
18205
18214
|
}
|
|
18206
18215
|
getObjects() {
|
|
18216
|
+
console.warn("VisualizeMarkup: getObjects() not implemented yet");
|
|
18207
18217
|
return [];
|
|
18208
18218
|
}
|
|
18209
18219
|
getSelectedObjects() {
|
|
18220
|
+
console.warn("VisualizeMarkup: getSelectedObjects() not implemented yet");
|
|
18210
18221
|
return [];
|
|
18211
18222
|
}
|
|
18212
|
-
selectObjects(objects) {
|
|
18213
|
-
|
|
18223
|
+
selectObjects(objects) {
|
|
18224
|
+
console.warn("VisualizeMarkup: selectObjects() not implemented yet");
|
|
18225
|
+
}
|
|
18226
|
+
clearSelected() {
|
|
18227
|
+
console.warn("VisualizeMarkup: clearSelected() not implemented yet");
|
|
18228
|
+
}
|
|
18214
18229
|
}
|
|
18215
18230
|
|
|
18216
18231
|
class MarkupFactory {
|
|
@@ -18251,7 +18266,7 @@ js: import "konva/skia-backend";
|
|
|
18251
18266
|
this._renderNeeded = false;
|
|
18252
18267
|
this._renderTime = 0;
|
|
18253
18268
|
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
|
|
18254
|
-
this.
|
|
18269
|
+
this._maxRegenTime = 0;
|
|
18255
18270
|
this.render = this.render.bind(this);
|
|
18256
18271
|
this.update = this.update.bind(this);
|
|
18257
18272
|
this._markup = MarkupFactory.createMarkup(params.markupType);
|
|
@@ -18357,18 +18372,6 @@ js: import "konva/skia-backend";
|
|
|
18357
18372
|
this.emitEvent({ type: "resize", width, height });
|
|
18358
18373
|
this.update(true);
|
|
18359
18374
|
}
|
|
18360
|
-
resize() {
|
|
18361
|
-
console.warn("Viewer.resize() has been deprecated since 26.9 and will be removed in a future release, use Viewer.setSize() instead.");
|
|
18362
|
-
if (!this.visualizeJs)
|
|
18363
|
-
return this;
|
|
18364
|
-
if (!this.canvas.parentElement)
|
|
18365
|
-
return this;
|
|
18366
|
-
const { width, height } = this.canvas.parentElement.getBoundingClientRect();
|
|
18367
|
-
if (!width || !height)
|
|
18368
|
-
return this;
|
|
18369
|
-
this.setSize(width, height);
|
|
18370
|
-
return this;
|
|
18371
|
-
}
|
|
18372
18375
|
update(force = false) {
|
|
18373
18376
|
const time = performance.now();
|
|
18374
18377
|
force = force || time - this._renderTime >= this._updateDelay;
|
|
@@ -18380,11 +18383,8 @@ js: import "konva/skia-backend";
|
|
|
18380
18383
|
this.emitEvent({ type: "update", force });
|
|
18381
18384
|
}
|
|
18382
18385
|
render(time) {
|
|
18383
|
-
var _a, _b;
|
|
18384
18386
|
if (!this.visualizeJs)
|
|
18385
18387
|
return;
|
|
18386
|
-
if (this._isRunAsyncUpdate)
|
|
18387
|
-
return;
|
|
18388
18388
|
const renderNeeded = this.visViewer().isRunningAnimation() || this._renderNeeded;
|
|
18389
18389
|
if (!renderNeeded)
|
|
18390
18390
|
return;
|
|
@@ -18393,8 +18393,7 @@ js: import "konva/skia-backend";
|
|
|
18393
18393
|
const deltaTime = (time - this._renderTime) / 1000;
|
|
18394
18394
|
this._renderTime = time;
|
|
18395
18395
|
this._renderNeeded = !this.visViewer().getActiveDevice().isValid();
|
|
18396
|
-
this.visViewer().update();
|
|
18397
|
-
(_b = (_a = this._activeDragger) === null || _a === void 0 ? void 0 : _a.updatePreview) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
18396
|
+
this.visViewer().update(this._maxRegenTime);
|
|
18398
18397
|
this.emitEvent({ type: "render", time, deltaTime });
|
|
18399
18398
|
}
|
|
18400
18399
|
async loadReferences(model) {
|
|
@@ -18412,12 +18411,12 @@ js: import "konva/skia-backend";
|
|
|
18412
18411
|
await model
|
|
18413
18412
|
.getReferences(abortController.signal)
|
|
18414
18413
|
.then((data) => (references = data.references))
|
|
18415
|
-
.catch((e) => console.error("Cannot load model references.", e));
|
|
18414
|
+
.catch((e) => console.error("Viewer: Cannot load model references.", e));
|
|
18416
18415
|
for (const file of references) {
|
|
18417
18416
|
await this.client
|
|
18418
18417
|
.downloadFile(file.id, undefined, abortController.signal)
|
|
18419
18418
|
.then((arrayBuffer) => { var _a; return (_a = this.visualizeJs) === null || _a === void 0 ? void 0 : _a.getViewer().addEmbeddedFile(file.name, new Uint8Array(arrayBuffer)); })
|
|
18420
|
-
.catch((e) => console.error(`Cannot load reference file ${file.name}.`, e));
|
|
18419
|
+
.catch((e) => console.error(`Viewer: Cannot load reference file ${file.name}.`, e));
|
|
18421
18420
|
}
|
|
18422
18421
|
return this;
|
|
18423
18422
|
}
|
|
@@ -18478,56 +18477,6 @@ js: import "konva/skia-backend";
|
|
|
18478
18477
|
this.update(true);
|
|
18479
18478
|
return this;
|
|
18480
18479
|
}
|
|
18481
|
-
openVsfFile(buffer) {
|
|
18482
|
-
console.warn("Viewer.openVsfFile() has been deprecated since 26.4 and will be removed in a future release, use Viewer.open() instead.");
|
|
18483
|
-
if (!this.visualizeJs)
|
|
18484
|
-
return this;
|
|
18485
|
-
this.cancel();
|
|
18486
|
-
this.clear();
|
|
18487
|
-
this.emitEvent({ type: "open", mode: "file", file: "", buffer });
|
|
18488
|
-
const visViewer = this.visViewer();
|
|
18489
|
-
this.emitEvent({ type: "geometrystart", file: "", buffer });
|
|
18490
|
-
try {
|
|
18491
|
-
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
18492
|
-
visViewer.parseFile(data);
|
|
18493
|
-
this.syncOptions();
|
|
18494
|
-
this.syncOverlay();
|
|
18495
|
-
this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
|
|
18496
|
-
this.emitEvent({ type: "databasechunk", data, file: "", buffer });
|
|
18497
|
-
}
|
|
18498
|
-
catch (error) {
|
|
18499
|
-
this.emitEvent({ type: "geometryerror", data: error, file: "", buffer });
|
|
18500
|
-
throw error;
|
|
18501
|
-
}
|
|
18502
|
-
this.emitEvent({ type: "geometryend", file: "", buffer });
|
|
18503
|
-
this.update(true);
|
|
18504
|
-
return this;
|
|
18505
|
-
}
|
|
18506
|
-
openVsfxFile(buffer) {
|
|
18507
|
-
console.warn("Viewer.openVsfxFile() has been deprecated since 26.4 and will be removed in a future release, use Viewer.open() instead.");
|
|
18508
|
-
if (!this.visualizeJs)
|
|
18509
|
-
return this;
|
|
18510
|
-
this.cancel();
|
|
18511
|
-
this.clear();
|
|
18512
|
-
this.emitEvent({ type: "open", mode: "file", file: "", buffer });
|
|
18513
|
-
const visViewer = this.visViewer();
|
|
18514
|
-
this.emitEvent({ type: "geometrystart", file: "", buffer });
|
|
18515
|
-
try {
|
|
18516
|
-
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
18517
|
-
visViewer.parseVsfx(data);
|
|
18518
|
-
this.syncOptions();
|
|
18519
|
-
this.syncOverlay();
|
|
18520
|
-
this.emitEvent({ type: "geometryprogress", data: 1, file: "", buffer });
|
|
18521
|
-
this.emitEvent({ type: "databasechunk", data, file: "", buffer });
|
|
18522
|
-
}
|
|
18523
|
-
catch (error) {
|
|
18524
|
-
this.emitEvent({ type: "geometryerror", data: error, file: "", buffer });
|
|
18525
|
-
throw error;
|
|
18526
|
-
}
|
|
18527
|
-
this.emitEvent({ type: "geometryend", file: "", buffer });
|
|
18528
|
-
this.update(true);
|
|
18529
|
-
return this;
|
|
18530
|
-
}
|
|
18531
18480
|
cancel() {
|
|
18532
18481
|
var _a;
|
|
18533
18482
|
(_a = this._abortControllerForReferences) === null || _a === void 0 ? void 0 : _a.abort();
|
|
@@ -18739,15 +18688,10 @@ js: import "konva/skia-backend";
|
|
|
18739
18688
|
collect() {
|
|
18740
18689
|
this.executeCommand("collect");
|
|
18741
18690
|
}
|
|
18742
|
-
registerDragger(name, dragger) {
|
|
18743
|
-
console.warn("Viewer.registerDragger() has been deprecated since 25.12 and will be removed in a future release, use draggers('visualizejs').registerDragger() instead.");
|
|
18744
|
-
draggers.registerDragger(name, (viewer) => new dragger(viewer));
|
|
18745
|
-
}
|
|
18746
18691
|
activeDragger() {
|
|
18747
18692
|
return this._activeDragger;
|
|
18748
18693
|
}
|
|
18749
18694
|
setActiveDragger(name = "") {
|
|
18750
|
-
var _a, _b;
|
|
18751
18695
|
if (!this._activeDragger || this._activeDragger.name !== name) {
|
|
18752
18696
|
const oldDragger = this._activeDragger;
|
|
18753
18697
|
let newDragger = null;
|
|
@@ -18757,10 +18701,7 @@ js: import "konva/skia-backend";
|
|
|
18757
18701
|
}
|
|
18758
18702
|
if (this.visualizeJs) {
|
|
18759
18703
|
newDragger = draggers.createDragger(name, this);
|
|
18760
|
-
|
|
18761
|
-
this._activeDragger = newDragger;
|
|
18762
|
-
(_b = (_a = this._activeDragger).initialize) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
18763
|
-
}
|
|
18704
|
+
this._activeDragger = newDragger;
|
|
18764
18705
|
}
|
|
18765
18706
|
const canvas = this.canvas;
|
|
18766
18707
|
if (canvas) {
|
|
@@ -18966,51 +18907,34 @@ js: import "konva/skia-backend";
|
|
|
18966
18907
|
const model = visViewer.getMarkupModel();
|
|
18967
18908
|
const entityId = model.appendEntity(entityName);
|
|
18968
18909
|
const entityPtr = entityId.openObject();
|
|
18969
|
-
const color = this.getMarkupColor();
|
|
18910
|
+
const color = this.markup.getMarkupColor();
|
|
18970
18911
|
entityPtr.setColor(color.r, color.g, color.b);
|
|
18971
18912
|
entityPtr.setLineWeight(2);
|
|
18972
18913
|
entityPtr.delete();
|
|
18973
18914
|
this.update();
|
|
18974
18915
|
return entityId;
|
|
18975
18916
|
}
|
|
18976
|
-
getMarkupColor() {
|
|
18977
|
-
console.warn("Viewer.getMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.getMarkupColor() instead.");
|
|
18978
|
-
return this._markup.getMarkupColor();
|
|
18979
|
-
}
|
|
18980
|
-
setMarkupColor(r = 255, g = 0, b = 0) {
|
|
18981
|
-
console.warn("Viewer.setMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.setMarkupColor() instead.");
|
|
18982
|
-
this._markup.setMarkupColor(r, g, b);
|
|
18983
|
-
}
|
|
18984
|
-
colorizeAllMarkup(r = 255, g = 0, b = 0) {
|
|
18985
|
-
console.warn("Viewer.colorizeAllMarkup() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.colorizeAllMarkup() instead.");
|
|
18986
|
-
this._markup.colorizeAllMarkup(r, g, b);
|
|
18987
|
-
}
|
|
18988
|
-
colorizeSelectedMarkups(r = 255, g = 0, b = 0) {
|
|
18989
|
-
this._markup.colorizeSelectedMarkups(r, g, b);
|
|
18990
|
-
}
|
|
18991
18917
|
scheduleUpdateAsync(maxScheduleUpdateTimeInMs = 50) {
|
|
18992
18918
|
return new Promise((resolve, reject) => {
|
|
18993
18919
|
setTimeout(() => {
|
|
18994
|
-
|
|
18920
|
+
this._maxRegenTime = maxScheduleUpdateTimeInMs;
|
|
18995
18921
|
try {
|
|
18996
|
-
|
|
18997
|
-
(_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update(maxScheduleUpdateTimeInMs);
|
|
18998
|
-
(_c = (_b = this._activeDragger) === null || _b === void 0 ? void 0 : _b.updatePreview) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
18999
|
-
}
|
|
19000
|
-
this.emitEvent({ type: "update", force: false });
|
|
18922
|
+
this.update(true);
|
|
19001
18923
|
resolve();
|
|
19002
18924
|
}
|
|
19003
18925
|
catch (e) {
|
|
19004
|
-
console.error(e);
|
|
18926
|
+
console.error("Viewer: Async update error.", e);
|
|
19005
18927
|
reject();
|
|
19006
18928
|
}
|
|
18929
|
+
finally {
|
|
18930
|
+
this._maxRegenTime = 0;
|
|
18931
|
+
}
|
|
19007
18932
|
}, 0);
|
|
19008
18933
|
});
|
|
19009
18934
|
}
|
|
19010
18935
|
async updateAsync(maxScheduleUpdateTimeInMs = 50, maxScheduleUpdateCount = 50) {
|
|
19011
18936
|
if (!this.visualizeJs)
|
|
19012
18937
|
return;
|
|
19013
|
-
this._isRunAsyncUpdate = true;
|
|
19014
18938
|
try {
|
|
19015
18939
|
const device = this.visViewer().getActiveDevice();
|
|
19016
18940
|
for (let iterationCount = 0; !device.isValid() && iterationCount < maxScheduleUpdateCount; iterationCount++) {
|
|
@@ -19019,10 +18943,7 @@ js: import "konva/skia-backend";
|
|
|
19019
18943
|
await this.scheduleUpdateAsync(maxScheduleUpdateTimeInMs);
|
|
19020
18944
|
}
|
|
19021
18945
|
catch (e) {
|
|
19022
|
-
console.error(e);
|
|
19023
|
-
}
|
|
19024
|
-
finally {
|
|
19025
|
-
this._isRunAsyncUpdate = false;
|
|
18946
|
+
console.error("Viewer: Async update error.", e);
|
|
19026
18947
|
}
|
|
19027
18948
|
}
|
|
19028
18949
|
deviceAutoRegeneration() {
|