@inweb/viewer-visualize 27.4.7 → 27.6.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 +239 -136
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +72 -48
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Components/CameraComponent.d.ts +1 -1
- package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +1 -1
- package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -1
- package/lib/Viewer/Markup/Visualize/VisualizeMarkup.d.ts +1 -1
- package/lib/Viewer/Viewer.d.ts +5 -5
- package/package.json +6 -6
- package/src/Viewer/Commands/SetSelected2.ts +1 -1
- package/src/Viewer/Commands/index.ts +21 -10
- package/src/Viewer/Components/CameraComponent.ts +5 -5
- package/src/Viewer/Components/CanvasRemoveComponent.ts +0 -1
- package/src/Viewer/Components/GestureManagerComponent.ts +0 -1
- package/src/Viewer/Components/ZoomWheelComponent.ts +0 -1
- package/src/Viewer/Draggers/Common/OdBaseDragger.ts +3 -1
- package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +2 -2
- package/src/Viewer/Draggers/MeasureLineDragger/index.ts +4 -4
- package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +6 -3
- package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +1 -1
- package/src/Viewer/Draggers/OdaLineDragger.ts +4 -5
- package/src/Viewer/Loaders/FileLoader.ts +6 -4
- package/src/Viewer/Loaders/VSFFileLoader.ts +1 -1
- package/src/Viewer/Loaders/VSFXCloudPartialLoader.ts +7 -5
- package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +1 -1
- package/src/Viewer/Loaders/VSFXFileLoader.ts +1 -1
- package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +1 -1
- package/src/Viewer/Models/ModelImpl.ts +1 -1
- package/src/Viewer/Viewer.ts +44 -23
- package/src/Viewer/utils.ts +1 -1
|
@@ -121,6 +121,7 @@ const INTERACTIVITY_FPS = 24;
|
|
|
121
121
|
class OdBaseDragger extends OdaGeAction {
|
|
122
122
|
constructor(subject) {
|
|
123
123
|
super(subject.visualizeJs);
|
|
124
|
+
this.name = "";
|
|
124
125
|
this.beginInteractivity = () => {
|
|
125
126
|
const viewer = this.getViewer();
|
|
126
127
|
const view = viewer.activeView;
|
|
@@ -147,6 +148,8 @@ class OdBaseDragger extends OdaGeAction {
|
|
|
147
148
|
this.needInputText = false;
|
|
148
149
|
this.mouseDownPosition = { x: 0, y: 0 };
|
|
149
150
|
this.autoSelect = false;
|
|
151
|
+
this.isDragging = false;
|
|
152
|
+
this.press = false;
|
|
150
153
|
this.pointerdown = this.pointerdown.bind(this);
|
|
151
154
|
this.pointerup = this.pointerup.bind(this);
|
|
152
155
|
this.pointercancel = this.pointercancel.bind(this);
|
|
@@ -650,16 +653,16 @@ class MeasureLineDragger extends OdBaseDragger {
|
|
|
650
653
|
this.m_overlayElement.style.zIndex = "1";
|
|
651
654
|
this.m_overlayElement.style.pointerEvents = "none";
|
|
652
655
|
document.body.appendChild(this.m_overlayElement);
|
|
653
|
-
this.
|
|
656
|
+
this.updateUnits = this.updateUnits.bind(this);
|
|
654
657
|
this.updatePreview = this.updatePreview.bind(this);
|
|
655
|
-
this.subject.addEventListener("optionschange", this.
|
|
658
|
+
this.subject.addEventListener("optionschange", this.updateUnits);
|
|
656
659
|
this.subject.addEventListener("render", this.updatePreview);
|
|
657
660
|
this.resize();
|
|
658
661
|
}
|
|
659
662
|
dispose() {
|
|
660
663
|
super.dispose();
|
|
661
664
|
this.m_overlayElement.remove();
|
|
662
|
-
this.subject.removeEventListener("optionschange", this.
|
|
665
|
+
this.subject.removeEventListener("optionschange", this.updateUnits);
|
|
663
666
|
this.subject.removeEventListener("render", this.updatePreview);
|
|
664
667
|
}
|
|
665
668
|
updatePreview() {
|
|
@@ -761,7 +764,7 @@ class MeasureLineDragger extends OdBaseDragger {
|
|
|
761
764
|
this.items.push(item);
|
|
762
765
|
return item;
|
|
763
766
|
}
|
|
764
|
-
|
|
767
|
+
updateUnits(event) {
|
|
765
768
|
var _a, _b;
|
|
766
769
|
const options = event.data;
|
|
767
770
|
const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
@@ -1544,9 +1547,8 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
1544
1547
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
1545
1548
|
avp.addCuttingPlane(plane);
|
|
1546
1549
|
this.index = avp.numCuttingPlanes() - 1;
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
|
|
1550
|
+
this.subject.syncOptions();
|
|
1551
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
1550
1552
|
this.m_model = this.getModel();
|
|
1551
1553
|
this.createPreview();
|
|
1552
1554
|
this.deleteAll([ext, avp, plane]);
|
|
@@ -1586,6 +1588,7 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
1586
1588
|
const plane = this.createPlane();
|
|
1587
1589
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
1588
1590
|
avp.updateCuttingPlane(this.index, plane);
|
|
1591
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
1589
1592
|
this.drawPreview();
|
|
1590
1593
|
this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
|
|
1591
1594
|
const device = this.getViewer().getActiveDevice();
|
|
@@ -1601,6 +1604,7 @@ class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
1601
1604
|
const plane = this.createPlane();
|
|
1602
1605
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
1603
1606
|
avp.updateCuttingPlane(this.index, plane);
|
|
1607
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
1604
1608
|
this.deleteAll([avp, plane, this.m_last]);
|
|
1605
1609
|
const device = this.getViewer().getActiveDevice();
|
|
1606
1610
|
device.invalidate(device.getSize());
|
|
@@ -1686,7 +1690,7 @@ class OdCuttingPlaneYAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
|
1686
1690
|
|
|
1687
1691
|
class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
1688
1692
|
createNormal() {
|
|
1689
|
-
return [0, 0, 1];
|
|
1693
|
+
return [0, 0, -1];
|
|
1690
1694
|
}
|
|
1691
1695
|
handleDelta(delta) {
|
|
1692
1696
|
delta.x = 0.0;
|
|
@@ -2331,16 +2335,16 @@ class OdaLineDragger extends OdBaseDragger {
|
|
|
2331
2335
|
constructor(subject) {
|
|
2332
2336
|
super(subject);
|
|
2333
2337
|
this.press = false;
|
|
2338
|
+
this.drawPoints = [];
|
|
2334
2339
|
}
|
|
2335
2340
|
dispose() {
|
|
2336
2341
|
super.dispose();
|
|
2337
2342
|
this.end();
|
|
2338
|
-
this.
|
|
2339
|
-
this.drawPoints = null;
|
|
2343
|
+
this.drawPoints.length = 0;
|
|
2340
2344
|
}
|
|
2341
2345
|
start(x, y) {
|
|
2342
2346
|
const point = this.getViewer().screenToWorld(x, y);
|
|
2343
|
-
this.drawPoints
|
|
2347
|
+
this.drawPoints.push(point[0], point[1], point[2]);
|
|
2344
2348
|
}
|
|
2345
2349
|
drag(x, y) {
|
|
2346
2350
|
if (this.isDragging) {
|
|
@@ -2352,7 +2356,7 @@ class OdaLineDragger extends OdBaseDragger {
|
|
|
2352
2356
|
end() {
|
|
2353
2357
|
if (this.entity) {
|
|
2354
2358
|
this.entity.delete();
|
|
2355
|
-
this.drawPoints =
|
|
2359
|
+
this.drawPoints.length = 0;
|
|
2356
2360
|
this.entity = null;
|
|
2357
2361
|
}
|
|
2358
2362
|
}
|
|
@@ -2851,24 +2855,34 @@ commands.registerCommand("zoomToExtents", zoomToExtents);
|
|
|
2851
2855
|
commands.registerCommand("zoomToObjects", zoomToObjects);
|
|
2852
2856
|
commands.registerCommand("zoomToSelected", zoomToSelected);
|
|
2853
2857
|
commands.registerCommand("autoTransformAllModelsToCentralPoint", autoTransformAllModelsToCentralPoint);
|
|
2854
|
-
commands.registerCommand("
|
|
2855
|
-
commands.registerCommand("
|
|
2856
|
-
commands.registerCommand("
|
|
2857
|
-
commands.registerCommand("
|
|
2858
|
-
commands.registerCommand("
|
|
2859
|
-
commands.registerCommand("
|
|
2860
|
-
commands.registerCommand("
|
|
2861
|
-
commands.registerCommand("
|
|
2862
|
-
commands.registerCommand("
|
|
2863
|
-
commands.registerCommand("
|
|
2858
|
+
commands.registerCommand("top", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
|
|
2859
|
+
commands.registerCommand("bottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
|
|
2860
|
+
commands.registerCommand("left", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
|
|
2861
|
+
commands.registerCommand("right", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
|
|
2862
|
+
commands.registerCommand("front", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
|
|
2863
|
+
commands.registerCommand("back", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
|
|
2864
|
+
commands.registerCommand("se", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
|
|
2865
|
+
commands.registerCommand("sw", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
|
|
2866
|
+
commands.registerCommand("ne", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
|
|
2867
|
+
commands.registerCommand("nw", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
|
|
2864
2868
|
commands.registerCommandAlias("clearMarkup", "clearOverlay");
|
|
2865
2869
|
commands.registerCommandAlias("clearSelected", "unselect");
|
|
2866
2870
|
commands.registerCommandAlias("getSnapshot", "createPreview");
|
|
2867
2871
|
commands.registerCommandAlias("zoomToExtents", "zoomExtents");
|
|
2872
|
+
commands.registerCommandAlias("top", "k3DViewTop");
|
|
2873
|
+
commands.registerCommandAlias("bottom", "k3DViewBottom");
|
|
2874
|
+
commands.registerCommandAlias("left", "k3DViewLeft");
|
|
2875
|
+
commands.registerCommandAlias("right", "k3DViewRight");
|
|
2876
|
+
commands.registerCommandAlias("front", "k3DViewFront");
|
|
2877
|
+
commands.registerCommandAlias("back", "k3DViewBack");
|
|
2878
|
+
commands.registerCommandAlias("se", "k3DViewSE");
|
|
2879
|
+
commands.registerCommandAlias("sw", "k3DViewSW");
|
|
2880
|
+
commands.registerCommandAlias("ne", "k3DViewNE");
|
|
2881
|
+
commands.registerCommandAlias("nw", "k3DViewNW");
|
|
2868
2882
|
|
|
2869
2883
|
class CameraComponent {
|
|
2870
2884
|
constructor(viewer) {
|
|
2871
|
-
this.
|
|
2885
|
+
this.syncOptions = () => {
|
|
2872
2886
|
this.switchCameraMode(this.viewer.options.cameraMode);
|
|
2873
2887
|
};
|
|
2874
2888
|
this.geometryEnd = () => {
|
|
@@ -2881,14 +2895,14 @@ class CameraComponent {
|
|
|
2881
2895
|
this.viewer = viewer;
|
|
2882
2896
|
this.viewer.addEventListener("databasechunk", this.geometryEnd);
|
|
2883
2897
|
this.viewer.addEventListener("clear", this.geometryEnd);
|
|
2884
|
-
this.viewer.addEventListener("optionschange", this.
|
|
2885
|
-
this.viewer.addEventListener("initialize", this.
|
|
2898
|
+
this.viewer.addEventListener("optionschange", this.syncOptions);
|
|
2899
|
+
this.viewer.addEventListener("initialize", this.syncOptions);
|
|
2886
2900
|
}
|
|
2887
2901
|
dispose() {
|
|
2888
2902
|
this.viewer.removeEventListener("databasechunk", this.geometryEnd);
|
|
2889
2903
|
this.viewer.removeEventListener("clear", this.geometryEnd);
|
|
2890
|
-
this.viewer.removeEventListener("optionschange", this.
|
|
2891
|
-
this.viewer.removeEventListener("initialize", this.
|
|
2904
|
+
this.viewer.removeEventListener("optionschange", this.syncOptions);
|
|
2905
|
+
this.viewer.removeEventListener("initialize", this.syncOptions);
|
|
2892
2906
|
}
|
|
2893
2907
|
getCameraMode(view) {
|
|
2894
2908
|
return view.perspective ? "perspective" : "orthographic";
|
|
@@ -3038,7 +3052,6 @@ class CanvasRemoveComponent {
|
|
|
3038
3052
|
}
|
|
3039
3053
|
dispose() {
|
|
3040
3054
|
this.mutationObserver.disconnect();
|
|
3041
|
-
this.mutationObserver = undefined;
|
|
3042
3055
|
}
|
|
3043
3056
|
}
|
|
3044
3057
|
|
|
@@ -3064,7 +3077,6 @@ class ZoomWheelComponent {
|
|
|
3064
3077
|
}
|
|
3065
3078
|
dispose() {
|
|
3066
3079
|
this.zoomWheelDragger.dispose();
|
|
3067
|
-
this.zoomWheelDragger = undefined;
|
|
3068
3080
|
}
|
|
3069
3081
|
}
|
|
3070
3082
|
|
|
@@ -3258,7 +3270,6 @@ class GestureManagerComponent {
|
|
|
3258
3270
|
}
|
|
3259
3271
|
dispose() {
|
|
3260
3272
|
this.gestureManager.dispose();
|
|
3261
|
-
this.gestureManager = undefined;
|
|
3262
3273
|
}
|
|
3263
3274
|
}
|
|
3264
3275
|
|
|
@@ -3321,6 +3332,9 @@ components.registerComponent("GestureManagerComponent", (viewer) => new GestureM
|
|
|
3321
3332
|
components.registerComponent("ResetComponent", (viewer) => new ResetComponent(viewer));
|
|
3322
3333
|
|
|
3323
3334
|
class ModelImpl {
|
|
3335
|
+
constructor() {
|
|
3336
|
+
this.id = "";
|
|
3337
|
+
}
|
|
3324
3338
|
dispose() { }
|
|
3325
3339
|
}
|
|
3326
3340
|
|
|
@@ -3328,7 +3342,6 @@ class FileLoader {
|
|
|
3328
3342
|
constructor() {
|
|
3329
3343
|
this.requestHeader = {};
|
|
3330
3344
|
this.withCredentials = false;
|
|
3331
|
-
this.abortSignal = undefined;
|
|
3332
3345
|
}
|
|
3333
3346
|
setRequestHeader(requestHeader) {
|
|
3334
3347
|
this.requestHeader = requestHeader;
|
|
@@ -3350,12 +3363,15 @@ class FileLoader {
|
|
|
3350
3363
|
.then((response) => {
|
|
3351
3364
|
if (!response.ok)
|
|
3352
3365
|
throw new Error(`Failed to fetch "${response.url}", status ${response.status}`);
|
|
3366
|
+
const body = response.body;
|
|
3367
|
+
if (!body)
|
|
3368
|
+
return response;
|
|
3353
3369
|
const contentLength = response.headers.get("X-File-Size") || response.headers.get("Content-Length");
|
|
3354
3370
|
const total = parseInt(contentLength || "", 10) || 0;
|
|
3355
3371
|
const lengthComputable = total > 0;
|
|
3356
3372
|
const stream = new ReadableStream({
|
|
3357
3373
|
async start(controller) {
|
|
3358
|
-
const reader =
|
|
3374
|
+
const reader = body.getReader();
|
|
3359
3375
|
let loaded = 0;
|
|
3360
3376
|
try {
|
|
3361
3377
|
while (true) {
|
|
@@ -3384,7 +3400,7 @@ class FileLoader {
|
|
|
3384
3400
|
const reader = new FileReader();
|
|
3385
3401
|
reader.onload = () => resolve(reader.result);
|
|
3386
3402
|
reader.onerror = () => reject(reader.error);
|
|
3387
|
-
reader.onprogress = onProgress;
|
|
3403
|
+
reader.onprogress = onProgress || null;
|
|
3388
3404
|
reader.readAsArrayBuffer(new Blob([file]));
|
|
3389
3405
|
});
|
|
3390
3406
|
}
|
|
@@ -3403,7 +3419,7 @@ class VSFFileLoader extends Loader {
|
|
|
3403
3419
|
super();
|
|
3404
3420
|
this.viewer = viewer;
|
|
3405
3421
|
}
|
|
3406
|
-
isSupport(file, format) {
|
|
3422
|
+
isSupport(file, format = "") {
|
|
3407
3423
|
return ((typeof file === "string" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&
|
|
3408
3424
|
/vsf$/i.test(format));
|
|
3409
3425
|
}
|
|
@@ -3498,7 +3514,7 @@ class VSFXFileLoader extends Loader {
|
|
|
3498
3514
|
super();
|
|
3499
3515
|
this.viewer = viewer;
|
|
3500
3516
|
}
|
|
3501
|
-
isSupport(file, format) {
|
|
3517
|
+
isSupport(file, format = "") {
|
|
3502
3518
|
return ((typeof file === "string" || file instanceof globalThis.File || file instanceof ArrayBuffer) &&
|
|
3503
3519
|
/vsfx$/i.test(format));
|
|
3504
3520
|
}
|
|
@@ -3627,7 +3643,7 @@ class VSFXCloudStreamingLoader extends Loader {
|
|
|
3627
3643
|
}
|
|
3628
3644
|
else {
|
|
3629
3645
|
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
|
|
3630
|
-
this.viewer.update();
|
|
3646
|
+
this.viewer.update(500);
|
|
3631
3647
|
}
|
|
3632
3648
|
};
|
|
3633
3649
|
await model.downloadResource(model.database, chunkLoadHandler, this.abortController.signal);
|
|
@@ -3685,7 +3701,7 @@ class VSFXCloudPartialLoader extends Loader {
|
|
|
3685
3701
|
}
|
|
3686
3702
|
else {
|
|
3687
3703
|
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
|
|
3688
|
-
this.viewer.update();
|
|
3704
|
+
this.viewer.update(500);
|
|
3689
3705
|
}
|
|
3690
3706
|
};
|
|
3691
3707
|
const downloadResourceRange = async (dataId, requestId, ranges) => {
|
|
@@ -3808,7 +3824,7 @@ function loadScript(url, params = {}) {
|
|
|
3808
3824
|
const script = document.createElement("script");
|
|
3809
3825
|
script.src = url;
|
|
3810
3826
|
script.async = true;
|
|
3811
|
-
script.crossOrigin = params.crossOrigin;
|
|
3827
|
+
script.crossOrigin = params.crossOrigin || null;
|
|
3812
3828
|
script.onload = () => resolve(script);
|
|
3813
3829
|
script.onerror = () => {
|
|
3814
3830
|
script.remove();
|
|
@@ -3850,6 +3866,7 @@ class VisualizeMarkup {
|
|
|
3850
3866
|
constructor() {
|
|
3851
3867
|
this._markupColor = { r: 255, g: 0, b: 0 };
|
|
3852
3868
|
this.lineWidth = 4;
|
|
3869
|
+
this.lineType = "solid";
|
|
3853
3870
|
this.fontSize = 34;
|
|
3854
3871
|
}
|
|
3855
3872
|
initialize(container, containerEvents, viewer, worldTransformer) {
|
|
@@ -4058,9 +4075,9 @@ class Viewer extends EventEmitter2 {
|
|
|
4058
4075
|
this.info = new Info();
|
|
4059
4076
|
this.canvasEvents = CANVAS_EVENTS.slice();
|
|
4060
4077
|
this.canvaseventlistener = (event) => this.emit(event);
|
|
4078
|
+
this._visualizeTimestamp = 0;
|
|
4061
4079
|
this._activeDragger = null;
|
|
4062
4080
|
this._components = [];
|
|
4063
|
-
this._updateDelay = 1000;
|
|
4064
4081
|
this._renderNeeded = false;
|
|
4065
4082
|
this._renderTime = 0;
|
|
4066
4083
|
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
|
|
@@ -4085,7 +4102,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4085
4102
|
return this._markup;
|
|
4086
4103
|
}
|
|
4087
4104
|
configure(params) {
|
|
4088
|
-
this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/
|
|
4105
|
+
this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
|
|
4089
4106
|
this._crossOrigin = params.crossOrigin;
|
|
4090
4107
|
return this;
|
|
4091
4108
|
}
|
|
@@ -4125,7 +4142,9 @@ class Viewer extends EventEmitter2 {
|
|
|
4125
4142
|
this.canvasEvents.forEach((x) => canvas.addEventListener(x, this.canvaseventlistener));
|
|
4126
4143
|
this._markup.initialize(this.canvas, this.canvasEvents, this, this);
|
|
4127
4144
|
for (const name of components.getComponents().keys()) {
|
|
4128
|
-
|
|
4145
|
+
const component = components.createComponent(name, this);
|
|
4146
|
+
if (component)
|
|
4147
|
+
this._components.push(component);
|
|
4129
4148
|
}
|
|
4130
4149
|
this.syncOptions();
|
|
4131
4150
|
this.syncOverlay();
|
|
@@ -4141,7 +4160,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4141
4160
|
this.removeAllListeners();
|
|
4142
4161
|
this.setActiveDragger();
|
|
4143
4162
|
this._components.forEach((component) => component.dispose());
|
|
4144
|
-
this._components =
|
|
4163
|
+
this._components.length = 0;
|
|
4145
4164
|
this._markup.dispose();
|
|
4146
4165
|
if (this.canvas) {
|
|
4147
4166
|
this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
|
|
@@ -4150,7 +4169,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4150
4169
|
if (this._viewer)
|
|
4151
4170
|
this._viewer.clear();
|
|
4152
4171
|
this._visualizeJs = undefined;
|
|
4153
|
-
this._visualizeTimestamp =
|
|
4172
|
+
this._visualizeTimestamp = 0;
|
|
4154
4173
|
this._viewer = undefined;
|
|
4155
4174
|
return this;
|
|
4156
4175
|
}
|
|
@@ -4172,13 +4191,14 @@ class Viewer extends EventEmitter2 {
|
|
|
4172
4191
|
}
|
|
4173
4192
|
update(force = false) {
|
|
4174
4193
|
const time = performance.now();
|
|
4175
|
-
|
|
4194
|
+
if (typeof force === "number" && time - this._renderTime >= force)
|
|
4195
|
+
force = true;
|
|
4176
4196
|
if (this._enableAutoUpdate) {
|
|
4177
4197
|
this._renderNeeded = true;
|
|
4178
4198
|
if (force)
|
|
4179
4199
|
this.render(time);
|
|
4180
4200
|
}
|
|
4181
|
-
this.emitEvent({ type: "update", force });
|
|
4201
|
+
this.emitEvent({ type: "update", force: !!force });
|
|
4182
4202
|
}
|
|
4183
4203
|
render(time) {
|
|
4184
4204
|
if (!this.visualizeJs)
|
|
@@ -4292,9 +4312,9 @@ class Viewer extends EventEmitter2 {
|
|
|
4292
4312
|
this.clearOverlay();
|
|
4293
4313
|
this.clearSelected();
|
|
4294
4314
|
this.loaders.forEach((loader) => loader.dispose());
|
|
4295
|
-
this.loaders =
|
|
4315
|
+
this.loaders.length = 0;
|
|
4296
4316
|
this.models.forEach((model) => model.dispose());
|
|
4297
|
-
this.models =
|
|
4317
|
+
this.models.length = 0;
|
|
4298
4318
|
visViewer.clear();
|
|
4299
4319
|
visViewer.createLocalDatabase();
|
|
4300
4320
|
this.syncOptions();
|
|
@@ -4384,6 +4404,8 @@ class Viewer extends EventEmitter2 {
|
|
|
4384
4404
|
visualStyleId.delete();
|
|
4385
4405
|
activeView.delete();
|
|
4386
4406
|
}
|
|
4407
|
+
view.setEnableCuttingPlaneFill(options.enableSectionFill, options.sectionFillColor.r, options.sectionFillColor.g, options.sectionFillColor.b);
|
|
4408
|
+
view.setCuttingPlaneFillPatternEnabled(options.enableSectionHatch, visLib.CuttingPlaneFillStyle.kSlantRight, options.sectionHatchColor.r, options.sectionHatchColor.g, options.sectionHatchColor.b);
|
|
4387
4409
|
const params = options.enableCustomHighlight ? options : Options.defaults();
|
|
4388
4410
|
const { Entry, OdTvRGBColorDef } = visLib;
|
|
4389
4411
|
const highlightStyleId = visViewer.findHighlightStyle("Web_Default");
|
|
@@ -4455,6 +4477,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4455
4477
|
const activeView = visViewer.activeView;
|
|
4456
4478
|
activeView.removeCuttingPlanes();
|
|
4457
4479
|
activeView.delete();
|
|
4480
|
+
this.emitEvent({ type: "changecuttingplanes" });
|
|
4458
4481
|
this.emitEvent({ type: "clearslices" });
|
|
4459
4482
|
this.update();
|
|
4460
4483
|
}
|
|
@@ -4523,7 +4546,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4523
4546
|
}
|
|
4524
4547
|
}
|
|
4525
4548
|
getComponent(name) {
|
|
4526
|
-
return this._components.find((component) => component.name === name);
|
|
4549
|
+
return this._components.find((component) => component.name === name) || null;
|
|
4527
4550
|
}
|
|
4528
4551
|
drawViewpoint(viewpoint) {
|
|
4529
4552
|
var _a, _b;
|
|
@@ -4566,6 +4589,7 @@ class Viewer extends EventEmitter2 {
|
|
|
4566
4589
|
activeView.addCuttingPlane(cuttingPlane);
|
|
4567
4590
|
activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
|
|
4568
4591
|
}
|
|
4592
|
+
this.emitEvent({ type: "changecuttingplanes" });
|
|
4569
4593
|
}
|
|
4570
4594
|
};
|
|
4571
4595
|
const setSelection = (selection) => {
|