@inweb/viewer-visualize 25.10.0 → 25.11.0
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 +237 -128
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +202 -81
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Commands/index.d.ts +1 -1
- package/lib/Viewer/Draggers/Actions/PanAction.d.ts +2 -2
- package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +1 -1
- package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +1 -1
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +4 -0
- package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +1 -1
- package/lib/Viewer/Draggers/OdPanDragger.d.ts +2 -2
- package/lib/Viewer/Draggers/OdZoomDragger.d.ts +5 -2
- package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +1 -1
- package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +1 -1
- package/lib/Viewer/Viewer.d.ts +18 -39
- package/package.json +6 -6
- package/src/Viewer/Commands/{Unselect.ts → ClearSelected.ts} +4 -3
- package/src/Viewer/Commands/Explode.ts +1 -1
- package/src/Viewer/Commands/HideSelected.ts +2 -1
- package/src/Viewer/Commands/IsolateSelected.ts +1 -1
- package/src/Viewer/Commands/ResetView.ts +1 -1
- package/src/Viewer/Commands/ShowAll.ts +1 -1
- package/src/Viewer/Commands/index.ts +1 -1
- package/src/Viewer/Draggers/Actions/PanAction.ts +8 -8
- package/src/Viewer/Draggers/Actions/ZoomAction.ts +3 -1
- package/src/Viewer/Draggers/Common/GestureManager.ts +3 -3
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +3 -3
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +6 -1
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +81 -3
- package/src/Viewer/Draggers/OdOrbitDragger.ts +1 -1
- package/src/Viewer/Draggers/OdPanDragger.ts +4 -4
- package/src/Viewer/Draggers/OdZoomDragger.ts +13 -4
- package/src/Viewer/Draggers/OdZoomWheelDragger.ts +3 -1
- package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +1 -1
- package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +1 -1
- package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +1 -0
- package/src/Viewer/Viewer.ts +47 -42
- /package/lib/Viewer/Commands/{Unselect.d.ts → ClearSelected.d.ts} +0 -0
package/dist/viewer-visualize.js
CHANGED
|
@@ -103,7 +103,8 @@
|
|
|
103
103
|
reverseZoomWheel: false,
|
|
104
104
|
enableZoomWheel: true,
|
|
105
105
|
enableGestures: true,
|
|
106
|
-
geometryType: "vsfx"
|
|
106
|
+
geometryType: "vsfx",
|
|
107
|
+
rulerUnit: "Default"
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -363,6 +364,13 @@
|
|
|
363
364
|
this._data.geometryType = value;
|
|
364
365
|
this.change();
|
|
365
366
|
}
|
|
367
|
+
get rulerUnit() {
|
|
368
|
+
return this._data.rulerUnit;
|
|
369
|
+
}
|
|
370
|
+
set rulerUnit(value) {
|
|
371
|
+
this._data.rulerUnit = value;
|
|
372
|
+
this.change();
|
|
373
|
+
}
|
|
366
374
|
}
|
|
367
375
|
|
|
368
376
|
const CanvasEvents = [ "click", "contextmenu", "dblclick", "mousedown", "mouseleave", "mousemove", "mouseup", "pointercancel", "pointerdown", "pointerleave", "pointermove", "pointerup", "touchcancel", "touchend", "touchmove", "touchstart", "wheel" ];
|
|
@@ -460,6 +468,39 @@
|
|
|
460
468
|
commands("VisualizeJS").registerCommand("clearMarkup", (viewer) => viewer.clearOverlay());
|
|
461
469
|
commands("VisualizeJS").registerCommandAlias("clearMarkup", "clearOverlay");
|
|
462
470
|
|
|
471
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
472
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
473
|
+
// All rights reserved.
|
|
474
|
+
//
|
|
475
|
+
// This software and its documentation and related materials are owned by
|
|
476
|
+
// the Alliance. The software may only be incorporated into application
|
|
477
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
478
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
479
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
480
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
481
|
+
// protected by copyright law and international treaty provisions. Application
|
|
482
|
+
// programs incorporating this software must include the following statement
|
|
483
|
+
// with their copyright notices:
|
|
484
|
+
//
|
|
485
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
486
|
+
// license agreement with Open Design Alliance.
|
|
487
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
488
|
+
// All rights reserved.
|
|
489
|
+
//
|
|
490
|
+
// By use of this software, its documentation or related materials, you
|
|
491
|
+
// acknowledge and accept the above terms.
|
|
492
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
493
|
+
function clearSelected(viewer) {
|
|
494
|
+
if (!viewer.visualizeJs)
|
|
495
|
+
return;
|
|
496
|
+
const visViewer = viewer.visViewer();
|
|
497
|
+
visViewer.unselect();
|
|
498
|
+
viewer.update();
|
|
499
|
+
viewer.emitEvent({ type: "select", data: undefined, handles: [] });
|
|
500
|
+
}
|
|
501
|
+
commands("VisualizeJS").registerCommand("clearSelected", clearSelected);
|
|
502
|
+
commands("VisualizeJS").registerCommandAlias("clearSelected", "unselect");
|
|
503
|
+
|
|
463
504
|
///////////////////////////////////////////////////////////////////////////////
|
|
464
505
|
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
465
506
|
// All rights reserved.
|
|
@@ -542,7 +583,7 @@
|
|
|
542
583
|
const visViewer = viewer.visViewer();
|
|
543
584
|
visViewer.explode(index);
|
|
544
585
|
viewer.update();
|
|
545
|
-
viewer.
|
|
586
|
+
viewer.emitEvent({ type: "explode", data: index });
|
|
546
587
|
}
|
|
547
588
|
commands("VisualizeJS").registerCommand("explode", explode);
|
|
548
589
|
commands("VisualizeJS").registerCommand("collect", (viewer) => explode(viewer, 0));
|
|
@@ -694,7 +735,8 @@
|
|
|
694
735
|
const visViewer = viewer.visViewer();
|
|
695
736
|
visViewer.hideSelectedObjects(false);
|
|
696
737
|
viewer.update();
|
|
697
|
-
viewer.
|
|
738
|
+
viewer.emitEvent({ type: "hide" });
|
|
739
|
+
viewer.emitEvent({ type: "select", data: undefined, handles: [] });
|
|
698
740
|
}
|
|
699
741
|
commands("VisualizeJS").registerCommand("hideSelected", hideSelected);
|
|
700
742
|
|
|
@@ -726,7 +768,7 @@
|
|
|
726
768
|
const visViewer = viewer.visViewer();
|
|
727
769
|
visViewer.isolateSelectedObjects(false);
|
|
728
770
|
viewer.update();
|
|
729
|
-
viewer.
|
|
771
|
+
viewer.emitEvent({ type: "isolate" });
|
|
730
772
|
}
|
|
731
773
|
commands("VisualizeJS").registerCommand("isolateSelected", isolateSelected);
|
|
732
774
|
|
|
@@ -791,7 +833,7 @@
|
|
|
791
833
|
viewer.executeCommand("clearSlices");
|
|
792
834
|
viewer.executeCommand("clearOverlay");
|
|
793
835
|
viewer.executeCommand("setMarkupColor");
|
|
794
|
-
viewer.executeCommand("
|
|
836
|
+
viewer.executeCommand("clearSelected");
|
|
795
837
|
viewer.executeCommand("showAll");
|
|
796
838
|
viewer.executeCommand("explode", 0);
|
|
797
839
|
viewer.executeCommand("zoomToExtents", true);
|
|
@@ -1008,42 +1050,10 @@
|
|
|
1008
1050
|
const visViewer = viewer.visViewer();
|
|
1009
1051
|
visViewer.unisolateSelectedObjects(false);
|
|
1010
1052
|
viewer.update();
|
|
1011
|
-
viewer.
|
|
1053
|
+
viewer.emitEvent({ type: "showall" });
|
|
1012
1054
|
}
|
|
1013
1055
|
commands("VisualizeJS").registerCommand("showAll", showAll);
|
|
1014
1056
|
|
|
1015
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
1016
|
-
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
1017
|
-
// All rights reserved.
|
|
1018
|
-
//
|
|
1019
|
-
// This software and its documentation and related materials are owned by
|
|
1020
|
-
// the Alliance. The software may only be incorporated into application
|
|
1021
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
1022
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
1023
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
1024
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
1025
|
-
// protected by copyright law and international treaty provisions. Application
|
|
1026
|
-
// programs incorporating this software must include the following statement
|
|
1027
|
-
// with their copyright notices:
|
|
1028
|
-
//
|
|
1029
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
1030
|
-
// license agreement with Open Design Alliance.
|
|
1031
|
-
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
1032
|
-
// All rights reserved.
|
|
1033
|
-
//
|
|
1034
|
-
// By use of this software, its documentation or related materials, you
|
|
1035
|
-
// acknowledge and accept the above terms.
|
|
1036
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
1037
|
-
function unselect(viewer) {
|
|
1038
|
-
if (!viewer.visualizeJs)
|
|
1039
|
-
return;
|
|
1040
|
-
const visViewer = viewer.visViewer();
|
|
1041
|
-
visViewer.unselect();
|
|
1042
|
-
viewer.update();
|
|
1043
|
-
viewer.emitEvent({ type: "select", data: visViewer.getSelected(), handles: [] });
|
|
1044
|
-
}
|
|
1045
|
-
commands("VisualizeJS").registerCommand("unselect", unselect);
|
|
1046
|
-
|
|
1047
1057
|
///////////////////////////////////////////////////////////////////////////////
|
|
1048
1058
|
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
1049
1059
|
// All rights reserved.
|
|
@@ -13705,33 +13715,21 @@
|
|
|
13705
13715
|
this._konvaStage.height(height);
|
|
13706
13716
|
};
|
|
13707
13717
|
this.pan = event => {
|
|
13708
|
-
const pointer = this._konvaStage.getPointerPosition();
|
|
13709
|
-
const pointTo = {
|
|
13710
|
-
x: (pointer.x - this._konvaStage.x()) / this._konvaStage.scaleX(),
|
|
13711
|
-
y: (pointer.y - this._konvaStage.y()) / this._konvaStage.scaleX()
|
|
13712
|
-
};
|
|
13713
13718
|
const newPos = {
|
|
13714
|
-
x:
|
|
13715
|
-
y:
|
|
13719
|
+
x: this._konvaStage.x() + event.dX,
|
|
13720
|
+
y: this._konvaStage.y() + event.dY
|
|
13716
13721
|
};
|
|
13717
13722
|
this._konvaStage.position(newPos);
|
|
13718
13723
|
};
|
|
13719
13724
|
this.zoomAt = event => {
|
|
13720
|
-
const
|
|
13721
|
-
const pointer = this._konvaStage.getPointerPosition();
|
|
13722
|
-
const mousePointTo = {
|
|
13723
|
-
x: (pointer.x - this._konvaStage.x()) / oldScale,
|
|
13724
|
-
y: (pointer.y - this._konvaStage.y()) / oldScale
|
|
13725
|
-
};
|
|
13726
|
-
const direction = event.data > 0 ? 1 : -1;
|
|
13727
|
-
const newScale = direction > 0 ? oldScale * event.data : oldScale / event.data;
|
|
13725
|
+
const newScale = this._konvaStage.scaleX() * event.data;
|
|
13728
13726
|
this._konvaStage.scale({
|
|
13729
13727
|
x: newScale,
|
|
13730
13728
|
y: newScale
|
|
13731
13729
|
});
|
|
13732
13730
|
const newPos = {
|
|
13733
|
-
x:
|
|
13734
|
-
y:
|
|
13731
|
+
x: event.x - (event.x - this._konvaStage.x()) * event.data,
|
|
13732
|
+
y: event.y - (event.y - this._konvaStage.y()) * event.data
|
|
13735
13733
|
};
|
|
13736
13734
|
this._konvaStage.position(newPos);
|
|
13737
13735
|
};
|
|
@@ -13757,6 +13755,7 @@
|
|
|
13757
13755
|
this._markupContainer.style.top = "0px";
|
|
13758
13756
|
this._markupContainer.style.left = "0px";
|
|
13759
13757
|
this._markupContainer.style.outline = "0px";
|
|
13758
|
+
this._markupContainer.style.pointerEvents = "none";
|
|
13760
13759
|
const parentDiv = this._container.parentElement;
|
|
13761
13760
|
parentDiv.appendChild(this._markupContainer);
|
|
13762
13761
|
this._resizeObserver = new ResizeObserver(this.resizeContainer);
|
|
@@ -13764,7 +13763,6 @@
|
|
|
13764
13763
|
this._markupColor.setColor(255, 0, 0);
|
|
13765
13764
|
this.initializeKonva();
|
|
13766
13765
|
if (this._viewer) {
|
|
13767
|
-
this._containerEvents.forEach((x => this._markupContainer.addEventListener(x, this.redirectToViewer)));
|
|
13768
13766
|
this._viewer.addEventListener("changeactivedragger", this.changeActiveDragger);
|
|
13769
13767
|
this._viewer.addEventListener("pan", this.pan);
|
|
13770
13768
|
this._viewer.addEventListener("zoomat", this.zoomAt);
|
|
@@ -13776,7 +13774,6 @@
|
|
|
13776
13774
|
this._viewer.removeEventListener("zoomat", this.zoomAt);
|
|
13777
13775
|
this._viewer.removeEventListener("pan", this.pan);
|
|
13778
13776
|
this._viewer.removeEventListener("changeactivedragger", this.changeActiveDragger);
|
|
13779
|
-
this._containerEvents.forEach((x => this._markupContainer.removeEventListener(x, this.redirectToViewer)));
|
|
13780
13777
|
}
|
|
13781
13778
|
this.destroyKonva();
|
|
13782
13779
|
(_a = this._resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
@@ -13800,6 +13797,14 @@
|
|
|
13800
13797
|
}
|
|
13801
13798
|
setMarkupColor(r, g, b) {
|
|
13802
13799
|
this._markupColor.setColor(r, g, b);
|
|
13800
|
+
this._viewer.emit({
|
|
13801
|
+
type: "changemarkupcolor",
|
|
13802
|
+
data: {
|
|
13803
|
+
r: r,
|
|
13804
|
+
g: g,
|
|
13805
|
+
b: b
|
|
13806
|
+
}
|
|
13807
|
+
});
|
|
13803
13808
|
}
|
|
13804
13809
|
colorizeAllMarkup(r, g, b) {
|
|
13805
13810
|
const hexColor = new MarkupColor(r, g, b).asHex();
|
|
@@ -13892,9 +13897,11 @@
|
|
|
13892
13897
|
this.clearSelected();
|
|
13893
13898
|
this.removeTextInput();
|
|
13894
13899
|
this.removeImageInput();
|
|
13900
|
+
this._markupContainer.style.pointerEvents = "none";
|
|
13895
13901
|
this._markupIsActive = false;
|
|
13896
13902
|
} else {
|
|
13897
13903
|
this._markupMode = mode;
|
|
13904
|
+
this._markupContainer.style.pointerEvents = "all";
|
|
13898
13905
|
this._markupIsActive = true;
|
|
13899
13906
|
}
|
|
13900
13907
|
return this;
|
|
@@ -14766,7 +14773,7 @@
|
|
|
14766
14773
|
}
|
|
14767
14774
|
ev.target.releasePointerCapture(ev.pointerId);
|
|
14768
14775
|
const relCoord = this.relativeCoords(ev);
|
|
14769
|
-
this.end(relCoord.x, relCoord.y);
|
|
14776
|
+
this.end(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
|
|
14770
14777
|
this.isDragging = false;
|
|
14771
14778
|
this.subject.update();
|
|
14772
14779
|
}
|
|
@@ -14781,7 +14788,7 @@
|
|
|
14781
14788
|
return;
|
|
14782
14789
|
}
|
|
14783
14790
|
const relCoord = this.relativeCoords(ev);
|
|
14784
|
-
this.drag(relCoord.x, relCoord.y, ev.
|
|
14791
|
+
this.drag(relCoord.x, relCoord.y, ev.clientX, ev.clientY);
|
|
14785
14792
|
if (this.isDragging) {
|
|
14786
14793
|
this.subject.update();
|
|
14787
14794
|
}
|
|
@@ -14830,7 +14837,7 @@
|
|
|
14830
14837
|
}
|
|
14831
14838
|
start(x, y, absoluteX = 0, absoluteY = 0) { }
|
|
14832
14839
|
drag(x, y, absoluteX = 0, absoluteY = 0) { }
|
|
14833
|
-
end(x, y) { }
|
|
14840
|
+
end(x, y, absoluteX = 0, absoluteY = 0) { }
|
|
14834
14841
|
getActiveMarkupEntity(entityName) {
|
|
14835
14842
|
return this.subject.addMarkupEntity(entityName);
|
|
14836
14843
|
}
|
|
@@ -15126,7 +15133,11 @@
|
|
|
15126
15133
|
}
|
|
15127
15134
|
}
|
|
15128
15135
|
getDistance() {
|
|
15129
|
-
|
|
15136
|
+
let distance = getDistance(this.startPoint, this.endPoint, this.moduleInstance);
|
|
15137
|
+
if (Math.abs(this.scale - 1.0) > 10e-5) {
|
|
15138
|
+
distance = (distance / this.scale).toFixed(2);
|
|
15139
|
+
}
|
|
15140
|
+
return distance;
|
|
15130
15141
|
}
|
|
15131
15142
|
setStartPoint(gePoint) {
|
|
15132
15143
|
this.startPoint = gePoint;
|
|
@@ -15182,6 +15193,7 @@
|
|
|
15182
15193
|
}
|
|
15183
15194
|
class MeasureLineDragger extends OdBaseDragger {
|
|
15184
15195
|
constructor(subject) {
|
|
15196
|
+
var _a;
|
|
15185
15197
|
super(subject);
|
|
15186
15198
|
this.lineThickness = 2;
|
|
15187
15199
|
this.press = false;
|
|
@@ -15199,10 +15211,12 @@
|
|
|
15199
15211
|
Miles: "mi",
|
|
15200
15212
|
Micrometers: "µm",
|
|
15201
15213
|
MicroInches: "µin",
|
|
15202
|
-
|
|
15214
|
+
Default: "unit",
|
|
15203
15215
|
};
|
|
15204
15216
|
this.items = [];
|
|
15205
15217
|
this.canvasEvents.push("resize");
|
|
15218
|
+
this.oldRulerUnit = (_a = subject.options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
15219
|
+
this.optionsChange = this.optionsChange.bind(this);
|
|
15206
15220
|
}
|
|
15207
15221
|
initialize() {
|
|
15208
15222
|
super.initialize();
|
|
@@ -15212,11 +15226,13 @@
|
|
|
15212
15226
|
this.m_overlayElement.style.zIndex = "1";
|
|
15213
15227
|
this.m_overlayElement.style.pointerEvents = "none";
|
|
15214
15228
|
document.body.appendChild(this.m_overlayElement);
|
|
15229
|
+
this.subject.addEventListener("optionschange", this.optionsChange);
|
|
15215
15230
|
this.resize();
|
|
15216
15231
|
}
|
|
15217
15232
|
dispose() {
|
|
15218
15233
|
super.dispose();
|
|
15219
15234
|
this.m_overlayElement.remove();
|
|
15235
|
+
this.subject.removeEventListener("optionschange", this.optionsChange);
|
|
15220
15236
|
}
|
|
15221
15237
|
updatePreview() {
|
|
15222
15238
|
this.items.forEach((item) => item.update());
|
|
@@ -15295,10 +15311,80 @@
|
|
|
15295
15311
|
const viewer = this.m_module.getViewer();
|
|
15296
15312
|
const item = new MeasureLineItem(this.m_overlayElement, viewer, this.m_module);
|
|
15297
15313
|
item.lineThickness = this.lineThickness || item.lineThickness;
|
|
15298
|
-
|
|
15314
|
+
const isDefaultUnit = !this.subject.options.rulerUnit || this.subject.options.rulerUnit === "Default";
|
|
15315
|
+
item.setUnit(renameUnit(this.renameUnitTable, isDefaultUnit ? viewer.getUnit() : this.subject.options.rulerUnit));
|
|
15316
|
+
if (!isDefaultUnit) {
|
|
15317
|
+
const fromUnit = this.getKUnitByName(viewer.getUnit());
|
|
15318
|
+
const toUnit = this.getKUnitByName(this.subject.options.rulerUnit);
|
|
15319
|
+
const multiplier = viewer.getUnitsConversionCoef(fromUnit, toUnit);
|
|
15320
|
+
this.conversionFactor = 1 / multiplier;
|
|
15321
|
+
item.setConversionFactor(this.conversionFactor);
|
|
15322
|
+
}
|
|
15323
|
+
else {
|
|
15324
|
+
item.setConversionFactor(1.0);
|
|
15325
|
+
}
|
|
15299
15326
|
this.items.push(item);
|
|
15300
15327
|
return item;
|
|
15301
15328
|
}
|
|
15329
|
+
optionsChange(event) {
|
|
15330
|
+
var _a;
|
|
15331
|
+
const options = event.data;
|
|
15332
|
+
const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
15333
|
+
if (this.oldRulerUnit === toUnitName)
|
|
15334
|
+
return;
|
|
15335
|
+
this.oldRulerUnit = toUnitName;
|
|
15336
|
+
const drawingUnit = this.m_module.getViewer().getUnit();
|
|
15337
|
+
const eToUnit = this.getKUnitByName(toUnitName);
|
|
15338
|
+
const eFromUnit = this.getKUnitByName(drawingUnit);
|
|
15339
|
+
this.items.forEach((item) => {
|
|
15340
|
+
if (toUnitName === "Default") {
|
|
15341
|
+
item.setUnit(renameUnit(this.renameUnitTable, drawingUnit));
|
|
15342
|
+
item.setConversionFactor(1.0);
|
|
15343
|
+
}
|
|
15344
|
+
else {
|
|
15345
|
+
item.setUnit(renameUnit(this.renameUnitTable, toUnitName));
|
|
15346
|
+
const multiplier = this.m_module.getViewer().getUnitsConversionCoef(eFromUnit, eToUnit);
|
|
15347
|
+
this.conversionFactor = 1 / multiplier;
|
|
15348
|
+
item.setConversionFactor(this.conversionFactor);
|
|
15349
|
+
}
|
|
15350
|
+
});
|
|
15351
|
+
}
|
|
15352
|
+
getKUnitByName(unitName) {
|
|
15353
|
+
let eUnit = this.m_module.Units.kUserDefined;
|
|
15354
|
+
switch (unitName) {
|
|
15355
|
+
case "Millimeters":
|
|
15356
|
+
eUnit = this.m_module.Units.kMillimeters;
|
|
15357
|
+
break;
|
|
15358
|
+
case "Centimeters":
|
|
15359
|
+
eUnit = this.m_module.Units.kCentimeters;
|
|
15360
|
+
break;
|
|
15361
|
+
case "Meters":
|
|
15362
|
+
eUnit = this.m_module.Units.kMeters;
|
|
15363
|
+
break;
|
|
15364
|
+
case "Feet":
|
|
15365
|
+
eUnit = this.m_module.Units.kFeet;
|
|
15366
|
+
break;
|
|
15367
|
+
case "Inches":
|
|
15368
|
+
eUnit = this.m_module.Units.kInches;
|
|
15369
|
+
break;
|
|
15370
|
+
case "Yards":
|
|
15371
|
+
eUnit = this.m_module.Units.kYards;
|
|
15372
|
+
break;
|
|
15373
|
+
case "Kilometers":
|
|
15374
|
+
eUnit = this.m_module.Units.kKilometers;
|
|
15375
|
+
break;
|
|
15376
|
+
case "Miles":
|
|
15377
|
+
eUnit = this.m_module.Units.kMiles;
|
|
15378
|
+
break;
|
|
15379
|
+
case "Micrometers":
|
|
15380
|
+
eUnit = this.m_module.Units.kMicrometers;
|
|
15381
|
+
break;
|
|
15382
|
+
case "MicroInches":
|
|
15383
|
+
eUnit = this.m_module.Units.kMicroInches;
|
|
15384
|
+
break;
|
|
15385
|
+
}
|
|
15386
|
+
return eUnit;
|
|
15387
|
+
}
|
|
15302
15388
|
}
|
|
15303
15389
|
|
|
15304
15390
|
const FocalLengthConst = 42.0;
|
|
@@ -15884,7 +15970,7 @@
|
|
|
15884
15970
|
extView.setView(this.startCameraParams.position, this.startCameraParams.target, this.startCameraParams.upVector, this.startCameraParams.viewFieldWidth, this.startCameraParams.viewFieldHeight, this.startCameraParams.perspective);
|
|
15885
15971
|
extView.delete();
|
|
15886
15972
|
}
|
|
15887
|
-
drag(x, y
|
|
15973
|
+
drag(x, y) {
|
|
15888
15974
|
if (this.press) {
|
|
15889
15975
|
this._orbitAction.action(x, y);
|
|
15890
15976
|
}
|
|
@@ -15926,12 +16012,12 @@
|
|
|
15926
16012
|
this._getViewParams = getViewParams;
|
|
15927
16013
|
this._setViewParams = setViewParams;
|
|
15928
16014
|
}
|
|
15929
|
-
beginAction(x, y) {
|
|
16015
|
+
beginAction(x, y, absoluteX, absoluteY) {
|
|
15930
16016
|
this._m_start = this.screenToWorld(x, y);
|
|
15931
|
-
this._deltaScreenPosition = { x, y };
|
|
16017
|
+
this._deltaScreenPosition = { x: absoluteX, y: absoluteY };
|
|
15932
16018
|
this._beginInteractivity();
|
|
15933
16019
|
}
|
|
15934
|
-
action(x, y) {
|
|
16020
|
+
action(x, y, absoluteX, absoluteY) {
|
|
15935
16021
|
var _a;
|
|
15936
16022
|
const { Vector3d } = this._m_module;
|
|
15937
16023
|
const params = this._getViewParams();
|
|
@@ -15952,12 +16038,12 @@
|
|
|
15952
16038
|
(_a = this._subject.activeDragger()) === null || _a === void 0 ? void 0 : _a.updatePreview();
|
|
15953
16039
|
this._subject.emitEvent({
|
|
15954
16040
|
type: "pan",
|
|
15955
|
-
x,
|
|
15956
|
-
y,
|
|
15957
|
-
dX:
|
|
15958
|
-
dY:
|
|
16041
|
+
x: absoluteX,
|
|
16042
|
+
y: absoluteY,
|
|
16043
|
+
dX: absoluteX - this._deltaScreenPosition.x,
|
|
16044
|
+
dY: absoluteY - this._deltaScreenPosition.y,
|
|
15959
16045
|
});
|
|
15960
|
-
this._deltaScreenPosition = { x, y };
|
|
16046
|
+
this._deltaScreenPosition = { x: absoluteX, y: absoluteY };
|
|
15961
16047
|
}
|
|
15962
16048
|
endAction() {
|
|
15963
16049
|
this._endInteractivity();
|
|
@@ -15974,13 +16060,13 @@
|
|
|
15974
16060
|
this.press = false;
|
|
15975
16061
|
this._panAction = new PanAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity, this.getViewParams, this.setViewParams);
|
|
15976
16062
|
}
|
|
15977
|
-
start(x, y) {
|
|
16063
|
+
start(x, y, absoluteX, absoluteY) {
|
|
15978
16064
|
this.press = true;
|
|
15979
|
-
this._panAction.beginAction(x, y);
|
|
16065
|
+
this._panAction.beginAction(x, y, absoluteX, absoluteY);
|
|
15980
16066
|
}
|
|
15981
|
-
drag(x, y,
|
|
16067
|
+
drag(x, y, absoluteX, absoluteY) {
|
|
15982
16068
|
if (this.press) {
|
|
15983
|
-
this._panAction.action(x, y);
|
|
16069
|
+
this._panAction.action(x, y, absoluteX, absoluteY);
|
|
15984
16070
|
}
|
|
15985
16071
|
}
|
|
15986
16072
|
end(x, y) {
|
|
@@ -16016,7 +16102,7 @@
|
|
|
16016
16102
|
this._m_module = m_module;
|
|
16017
16103
|
this._subject = subject;
|
|
16018
16104
|
}
|
|
16019
|
-
action(x, y, zoomFactor) {
|
|
16105
|
+
action(x, y, zoomFactor, absoluteX, absoluteY) {
|
|
16020
16106
|
var _a;
|
|
16021
16107
|
const viewer = this._m_module.getViewer();
|
|
16022
16108
|
viewer.zoomAt(zoomFactor, x, y);
|
|
@@ -16025,10 +16111,34 @@
|
|
|
16025
16111
|
this._subject.emitEvent({
|
|
16026
16112
|
type: "zoomat",
|
|
16027
16113
|
data: zoomFactor,
|
|
16114
|
+
x: absoluteX,
|
|
16115
|
+
y: absoluteY,
|
|
16028
16116
|
});
|
|
16029
16117
|
}
|
|
16030
16118
|
}
|
|
16031
16119
|
|
|
16120
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
16121
|
+
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
|
|
16122
|
+
// All rights reserved.
|
|
16123
|
+
//
|
|
16124
|
+
// This software and its documentation and related materials are owned by
|
|
16125
|
+
// the Alliance. The software may only be incorporated into application
|
|
16126
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
16127
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
16128
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
16129
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
16130
|
+
// protected by copyright law and international treaty provisions. Application
|
|
16131
|
+
// programs incorporating this software must include the following statement
|
|
16132
|
+
// with their copyright notices:
|
|
16133
|
+
//
|
|
16134
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16135
|
+
// license agreement with Open Design Alliance.
|
|
16136
|
+
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
|
|
16137
|
+
// All rights reserved.
|
|
16138
|
+
//
|
|
16139
|
+
// By use of this software, its documentation or related materials, you
|
|
16140
|
+
// acknowledge and accept the above terms.
|
|
16141
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
16032
16142
|
class OdZoomDragger extends OdBaseDragger {
|
|
16033
16143
|
constructor(subject) {
|
|
16034
16144
|
super(subject);
|
|
@@ -16036,17 +16146,22 @@
|
|
|
16036
16146
|
this.press = false;
|
|
16037
16147
|
this._zoomAction = new ZoomAction(this.m_module, this.subject);
|
|
16038
16148
|
}
|
|
16039
|
-
start(x, y) {
|
|
16149
|
+
start(x, y, absoluteX = 0, absoluteY = 0) {
|
|
16040
16150
|
this.press = true;
|
|
16041
16151
|
this.pressX = x;
|
|
16042
16152
|
this.pressY = y;
|
|
16153
|
+
this.absoluteX = absoluteX;
|
|
16154
|
+
this.absoluteY = absoluteY;
|
|
16155
|
+
this.prevY = y;
|
|
16043
16156
|
this.beginInteractivity();
|
|
16044
16157
|
}
|
|
16045
|
-
drag(x, y
|
|
16158
|
+
drag(x, y) {
|
|
16159
|
+
const dltY = y - this.prevY;
|
|
16160
|
+
this.prevY = y;
|
|
16046
16161
|
if (this.press && Math.abs(dltY) >= 10e-6) {
|
|
16047
16162
|
const ZOOM_SPEED = 0.025;
|
|
16048
16163
|
const zoomFactor = dltY > 0 ? 1 + ZOOM_SPEED : 1 - ZOOM_SPEED;
|
|
16049
|
-
this._zoomAction.action(this.pressX, this.pressY, zoomFactor);
|
|
16164
|
+
this._zoomAction.action(this.pressX, this.pressY, zoomFactor, this.absoluteX, this.absoluteY);
|
|
16050
16165
|
}
|
|
16051
16166
|
}
|
|
16052
16167
|
end() {
|
|
@@ -16098,7 +16213,7 @@
|
|
|
16098
16213
|
const viewer = this.getViewer();
|
|
16099
16214
|
if (viewer) {
|
|
16100
16215
|
const zoomFactor = event.deltaY > 0 ? 1 + zoomSpeed : 1 - zoomSpeed;
|
|
16101
|
-
this._zoomAction.action(event.offsetX * window.devicePixelRatio, event.offsetY * window.devicePixelRatio, zoomFactor);
|
|
16216
|
+
this._zoomAction.action(event.offsetX * window.devicePixelRatio, event.offsetY * window.devicePixelRatio, zoomFactor, event.offsetX, event.offsetY);
|
|
16102
16217
|
if (!this._isEnableInteractivityMode) {
|
|
16103
16218
|
this._isEnableInteractivityMode = true;
|
|
16104
16219
|
this.beginInteractivity();
|
|
@@ -16245,7 +16360,7 @@
|
|
|
16245
16360
|
const startPoint = this.screenToWorld(x, y);
|
|
16246
16361
|
this.m_frame.setStartPoint(startPoint);
|
|
16247
16362
|
}
|
|
16248
|
-
drag(x, y
|
|
16363
|
+
drag(x, y) {
|
|
16249
16364
|
if (this.press) {
|
|
16250
16365
|
this.m_maxX = x;
|
|
16251
16366
|
this.m_maxY = y;
|
|
@@ -16285,7 +16400,7 @@
|
|
|
16285
16400
|
setDefaultViewParams() {
|
|
16286
16401
|
this.setViewParams(this.startCameraParams);
|
|
16287
16402
|
}
|
|
16288
|
-
drag(x, y
|
|
16403
|
+
drag(x, y) {
|
|
16289
16404
|
if (this.press) {
|
|
16290
16405
|
let dX = x - this.m_startPoint.x;
|
|
16291
16406
|
let dY = y - this.m_startPoint.y;
|
|
@@ -16502,7 +16617,7 @@
|
|
|
16502
16617
|
const zoomSpeed = (currentDistance - previousDistance) / 700;
|
|
16503
16618
|
const zoomFactor = 1 + zoomSpeed;
|
|
16504
16619
|
const middlePoint = this.getMiddlePoint(this._currentEvents);
|
|
16505
|
-
this._zoomAction.action(middlePoint.x, middlePoint.y, zoomFactor);
|
|
16620
|
+
this._zoomAction.action(middlePoint.x, middlePoint.y, zoomFactor, middlePoint.x, middlePoint.y);
|
|
16506
16621
|
this.subject.update();
|
|
16507
16622
|
}
|
|
16508
16623
|
executePanAction(currentPoint) {
|
|
@@ -16510,9 +16625,9 @@
|
|
|
16510
16625
|
this.executeEndAction(this._lastGestureAction);
|
|
16511
16626
|
this._lastGestureAction = GestureAction.Pan;
|
|
16512
16627
|
OdBaseDragger.isGestureActive = true;
|
|
16513
|
-
this._panAction.beginAction(currentPoint.x, currentPoint.y);
|
|
16628
|
+
this._panAction.beginAction(currentPoint.x, currentPoint.y, currentPoint.x, currentPoint.y);
|
|
16514
16629
|
}
|
|
16515
|
-
this._panAction.action(currentPoint.x, currentPoint.y);
|
|
16630
|
+
this._panAction.action(currentPoint.x, currentPoint.y, currentPoint.x, currentPoint.y);
|
|
16516
16631
|
this.subject.update();
|
|
16517
16632
|
}
|
|
16518
16633
|
executeOrbitAction(currentPoint) {
|
|
@@ -17259,6 +17374,7 @@
|
|
|
17259
17374
|
setMarkupColor(r, g, b) {
|
|
17260
17375
|
const color = { r, g, b };
|
|
17261
17376
|
this._markupColor = color;
|
|
17377
|
+
this._viewer.emitEvent({ type: "changemarkupcolor", data: color });
|
|
17262
17378
|
}
|
|
17263
17379
|
colorizeAllMarkup(r = 255, g = 0, b = 0) {
|
|
17264
17380
|
if (!this._viewer.visualizeJs)
|
|
@@ -18069,24 +18185,30 @@
|
|
|
18069
18185
|
result.z = 1 / z;
|
|
18070
18186
|
return result;
|
|
18071
18187
|
}
|
|
18072
|
-
/**
|
|
18073
|
-
* Returns a list of original handles for the selected objects.
|
|
18074
|
-
*/
|
|
18075
18188
|
getSelected() {
|
|
18076
18189
|
return this.executeCommand("getSelected");
|
|
18077
18190
|
}
|
|
18078
|
-
/**
|
|
18079
|
-
* Selects the model objects by original handles that are obtained using `File.searchProperties()`.
|
|
18080
|
-
*
|
|
18081
|
-
* Fires:
|
|
18082
|
-
*
|
|
18083
|
-
* - {@link SelectEvent | select}
|
|
18084
|
-
*
|
|
18085
|
-
* @param handles - The list of original handles.
|
|
18086
|
-
*/
|
|
18087
18191
|
setSelected(handles) {
|
|
18088
18192
|
this.executeCommand("setSelected", handles);
|
|
18089
18193
|
}
|
|
18194
|
+
clearSelected() {
|
|
18195
|
+
this.executeCommand("clearSelected");
|
|
18196
|
+
}
|
|
18197
|
+
hideSelected() {
|
|
18198
|
+
this.executeCommand("hideSelected");
|
|
18199
|
+
}
|
|
18200
|
+
isolateSelected() {
|
|
18201
|
+
this.executeCommand("isolateSelected");
|
|
18202
|
+
}
|
|
18203
|
+
showAll() {
|
|
18204
|
+
this.executeCommand("showAll");
|
|
18205
|
+
}
|
|
18206
|
+
explode(index = 0) {
|
|
18207
|
+
this.executeCommand("explode", index);
|
|
18208
|
+
}
|
|
18209
|
+
collect() {
|
|
18210
|
+
this.executeCommand("collect");
|
|
18211
|
+
}
|
|
18090
18212
|
// Internal loading routines
|
|
18091
18213
|
async loadReferences(model) {
|
|
18092
18214
|
var _a;
|
|
@@ -18133,8 +18255,8 @@
|
|
|
18133
18255
|
*
|
|
18134
18256
|
* The file geometry data on the server must be converted to `VSFX` format.
|
|
18135
18257
|
*
|
|
18136
|
-
* To open a large file, enable {@link IOptions.enablePartialMode | partial
|
|
18137
|
-
* opening (see example below).
|
|
18258
|
+
* To open a large file, enable {@link IOptions.enablePartialMode | partial streaming} mode
|
|
18259
|
+
* before opening (see example below).
|
|
18138
18260
|
*
|
|
18139
18261
|
* This method requires a `Client` instance to be specified when creating the viewer to load
|
|
18140
18262
|
* model reference files from the Open Cloud Server. For a standalone viewer instance use
|
|
@@ -18150,7 +18272,7 @@
|
|
|
18150
18272
|
* - {@link GeometryEndEvent | geometryend}
|
|
18151
18273
|
* - {@link GeometryErrorEvent | geometryerror}
|
|
18152
18274
|
*
|
|
18153
|
-
* @example <caption>Using partial
|
|
18275
|
+
* @example <caption>Using partial streaming mode to open a large file from a server.</caption>
|
|
18154
18276
|
* viewer.options.enableStreamingMode = true;
|
|
18155
18277
|
* viewer.options.enablePartialMode = true;
|
|
18156
18278
|
* await viewer.open(file);
|
|
@@ -18175,7 +18297,8 @@
|
|
|
18175
18297
|
const overrideOptions = new Options();
|
|
18176
18298
|
overrideOptions.data = this._options.data;
|
|
18177
18299
|
if (file.type === ".rcs" && !overrideOptions.enablePartialMode) {
|
|
18178
|
-
console.log("Partial
|
|
18300
|
+
console.log("Partial streaming mode is forced for RCS file");
|
|
18301
|
+
overrideOptions.enableStreamingMode = true;
|
|
18179
18302
|
overrideOptions.enablePartialMode = true;
|
|
18180
18303
|
}
|
|
18181
18304
|
const loaderFactory = new LoaderFactory();
|
|
@@ -18192,7 +18315,7 @@
|
|
|
18192
18315
|
* Loads a `VSF` file into the viewer.
|
|
18193
18316
|
*
|
|
18194
18317
|
* This method does not support {@link IOptions.enableStreamingMode | streaming} or
|
|
18195
|
-
* {@link IOptions.enablePartialMode | partial
|
|
18318
|
+
* {@link IOptions.enablePartialMode | partial streaming} mode.
|
|
18196
18319
|
*
|
|
18197
18320
|
* Fires:
|
|
18198
18321
|
*
|
|
@@ -18234,7 +18357,7 @@
|
|
|
18234
18357
|
* Loads a `VSFX` file into the viewer.
|
|
18235
18358
|
*
|
|
18236
18359
|
* This method does not support {@link IOptions.enableStreamingMode | streaming} or
|
|
18237
|
-
* {@link IOptions.enablePartialMode | partial
|
|
18360
|
+
* {@link IOptions.enablePartialMode | partial streaming} mode.
|
|
18238
18361
|
*
|
|
18239
18362
|
* Fires:
|
|
18240
18363
|
*
|
|
@@ -18299,43 +18422,29 @@
|
|
|
18299
18422
|
return this;
|
|
18300
18423
|
}
|
|
18301
18424
|
/**
|
|
18302
|
-
*
|
|
18425
|
+
* Deprecated since `25.11`. Use {@link IMarkup.getMarkupColor | markup.getMarkupColor()} instead.
|
|
18303
18426
|
*/
|
|
18304
18427
|
getMarkupColor() {
|
|
18428
|
+
console.warn("Viewer.getMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.getMarkupColor() instead.");
|
|
18305
18429
|
return this._markup.getMarkupColor();
|
|
18306
18430
|
}
|
|
18307
18431
|
/**
|
|
18308
|
-
*
|
|
18309
|
-
*
|
|
18310
|
-
* Fires:
|
|
18311
|
-
*
|
|
18312
|
-
* - {@link ChangeMarkupColorEvent | changemarkupcolor}
|
|
18313
|
-
*
|
|
18314
|
-
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
18315
|
-
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
18316
|
-
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
18432
|
+
* Deprecated since `25.11`. Use {@link IMarkup.setMarkupColor | markup.setMarkupColor()} instead.
|
|
18317
18433
|
*/
|
|
18318
18434
|
setMarkupColor(r = 255, g = 0, b = 0) {
|
|
18435
|
+
console.warn("Viewer.setMarkupColor() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.setMarkupColor() instead.");
|
|
18319
18436
|
this._markup.setMarkupColor(r, g, b);
|
|
18320
|
-
const color = { r, g, b };
|
|
18321
|
-
this.emitEvent({ type: "changemarkupcolor", data: color });
|
|
18322
18437
|
}
|
|
18323
18438
|
/**
|
|
18324
|
-
*
|
|
18325
|
-
*
|
|
18326
|
-
* @param r - The `red` component of the color, as a number between 0 and 255.
|
|
18327
|
-
* @param g - The `green` component of the color, as a number between 0 and 255.
|
|
18328
|
-
* @param b - The `blue` component of the color, as a number between 0 and 255.
|
|
18439
|
+
* Deprecated since `25.11`. Use {@link IMarkup.colorizeAllMarkup | markup.colorizeAllMarkup()} instead.
|
|
18329
18440
|
*/
|
|
18330
18441
|
colorizeAllMarkup(r = 255, g = 0, b = 0) {
|
|
18442
|
+
console.warn("Viewer.colorizeAllMarkup() has been deprecated since 25.11 and will be removed in a future release, use Viewer.markup.colorizeAllMarkup() instead.");
|
|
18331
18443
|
this._markup.colorizeAllMarkup(r, g, b);
|
|
18332
18444
|
}
|
|
18333
18445
|
/**
|
|
18334
|
-
*
|
|
18335
|
-
*
|
|
18336
|
-
* @param r - `Red` part of color.
|
|
18337
|
-
* @param g - `Green` part of color.
|
|
18338
|
-
* @param b - `Blue` part of color.
|
|
18446
|
+
* Deprecated since `25.11`. Use
|
|
18447
|
+
* {@link IMarkup.colorizeSelectedMarkups | markup.colorizeSelectedMarkups()} instead.
|
|
18339
18448
|
*/
|
|
18340
18449
|
colorizeSelectedMarkups(r = 255, g = 0, b = 0) {
|
|
18341
18450
|
this._markup.colorizeSelectedMarkups(r, g, b);
|
|
@@ -18440,11 +18549,12 @@
|
|
|
18440
18549
|
* Executes the command denoted by the given command. If the command is not found, tries to
|
|
18441
18550
|
* set active dragger with the specified name.
|
|
18442
18551
|
*
|
|
18443
|
-
* The following commands are
|
|
18552
|
+
* The following commands are available by default:
|
|
18444
18553
|
*
|
|
18445
18554
|
* - `applyModelTransform`
|
|
18446
18555
|
* - `autoTransformAllModelsToCentralPoint`
|
|
18447
18556
|
* - `clearMarkup`
|
|
18557
|
+
* - `clearSelected`
|
|
18448
18558
|
* - `clearSlices`
|
|
18449
18559
|
* - `createPreview`
|
|
18450
18560
|
* - `explode`
|
|
@@ -18461,7 +18571,6 @@
|
|
|
18461
18571
|
* - `setMarkupColor`
|
|
18462
18572
|
* - `setSelected`
|
|
18463
18573
|
* - `showAll`
|
|
18464
|
-
* - `unselect`
|
|
18465
18574
|
* - `zoomToExtents`
|
|
18466
18575
|
* - `zoomToObjects`
|
|
18467
18576
|
* - `zoomToSelected`
|