@inweb/viewer-visualize 27.4.7 → 27.5.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 +146 -38
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +51 -33
- 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/Viewer.d.ts +4 -4
- package/package.json +6 -6
- package/src/Viewer/Commands/index.ts +21 -10
- package/src/Viewer/Components/CameraComponent.ts +5 -5
- 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/Loaders/VSFXCloudPartialLoader.ts +1 -1
- package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +1 -1
- package/src/Viewer/Viewer.ts +34 -12
|
@@ -23,6 +23,6 @@ export declare class MeasureLineDragger extends OdBaseDragger {
|
|
|
23
23
|
end(): void;
|
|
24
24
|
createNewMeasureIfNeed(): void;
|
|
25
25
|
createMeasureLine(): MeasureLineItem;
|
|
26
|
-
|
|
26
|
+
updateUnits(event: any): void;
|
|
27
27
|
getKUnitByName(unitName: string): any;
|
|
28
28
|
}
|
package/lib/Viewer/Viewer.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
23
23
|
private _crossOrigin;
|
|
24
24
|
private _activeDragger;
|
|
25
25
|
private _components;
|
|
26
|
-
private _updateDelay;
|
|
27
26
|
private _renderNeeded;
|
|
28
27
|
private _renderTime;
|
|
29
28
|
private _enableAutoUpdate;
|
|
@@ -132,10 +131,11 @@ export declare class Viewer extends EventEmitter2<ViewerEventMap & CanvasEventMa
|
|
|
132
131
|
* - {@link UpdateEvent | update}
|
|
133
132
|
* - {@link RenderEvent | render}
|
|
134
133
|
*
|
|
135
|
-
* @param force - If `true` updates the viewer immidietly.
|
|
136
|
-
*
|
|
134
|
+
* @param force - If `true` updates the viewer immidietly. If a `number` is specified and more than the
|
|
135
|
+
* given amount of milliseconds has elapsed since the last rendering, the update is performed
|
|
136
|
+
* immediately as well. Otherwise updates on next animation frame. Default is `false`.
|
|
137
137
|
*/
|
|
138
|
-
update(force?: boolean): void;
|
|
138
|
+
update(force?: boolean | number): void;
|
|
139
139
|
render(time?: DOMHighResTimeStamp): void;
|
|
140
140
|
loadReferences(model: Model | File | Assembly): Promise<this>;
|
|
141
141
|
applyModelTransformMatrix(model: Model | Assembly): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inweb/viewer-visualize",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.5.0",
|
|
4
4
|
"description": "JavaScript library for rendering CAD and BIM files in a browser using VisualizeJS",
|
|
5
5
|
"homepage": "https://cloud.opendesign.com/docs/index.html",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"docs": "typedoc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@inweb/client": "~27.
|
|
33
|
-
"@inweb/eventemitter2": "~27.
|
|
34
|
-
"@inweb/markup": "~27.
|
|
35
|
-
"@inweb/viewer-core": "~27.
|
|
32
|
+
"@inweb/client": "~27.5.0",
|
|
33
|
+
"@inweb/eventemitter2": "~27.5.0",
|
|
34
|
+
"@inweb/markup": "~27.5.0",
|
|
35
|
+
"@inweb/viewer-core": "~27.5.0"
|
|
36
36
|
},
|
|
37
|
-
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/
|
|
37
|
+
"visualizeJS": "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js"
|
|
38
38
|
}
|
|
@@ -106,18 +106,29 @@ commands.registerCommand("zoomToObjects", zoomToObjects);
|
|
|
106
106
|
commands.registerCommand("zoomToSelected", zoomToSelected);
|
|
107
107
|
commands.registerCommand("autoTransformAllModelsToCentralPoint", autoTransformAllModelsToCentralPoint);
|
|
108
108
|
|
|
109
|
-
commands.registerCommand("
|
|
110
|
-
commands.registerCommand("
|
|
111
|
-
commands.registerCommand("
|
|
112
|
-
commands.registerCommand("
|
|
113
|
-
commands.registerCommand("
|
|
114
|
-
commands.registerCommand("
|
|
115
|
-
commands.registerCommand("
|
|
116
|
-
commands.registerCommand("
|
|
117
|
-
commands.registerCommand("
|
|
118
|
-
commands.registerCommand("
|
|
109
|
+
commands.registerCommand("top", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
|
|
110
|
+
commands.registerCommand("bottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
|
|
111
|
+
commands.registerCommand("left", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
|
|
112
|
+
commands.registerCommand("right", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
|
|
113
|
+
commands.registerCommand("front", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
|
|
114
|
+
commands.registerCommand("back", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
|
|
115
|
+
commands.registerCommand("se", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
|
|
116
|
+
commands.registerCommand("sw", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
|
|
117
|
+
commands.registerCommand("ne", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
|
|
118
|
+
commands.registerCommand("nw", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
|
|
119
119
|
|
|
120
120
|
commands.registerCommandAlias("clearMarkup", "clearOverlay");
|
|
121
121
|
commands.registerCommandAlias("clearSelected", "unselect");
|
|
122
122
|
commands.registerCommandAlias("getSnapshot", "createPreview");
|
|
123
123
|
commands.registerCommandAlias("zoomToExtents", "zoomExtents");
|
|
124
|
+
|
|
125
|
+
commands.registerCommandAlias("top", "k3DViewTop");
|
|
126
|
+
commands.registerCommandAlias("bottom", "k3DViewBottom");
|
|
127
|
+
commands.registerCommandAlias("left", "k3DViewLeft");
|
|
128
|
+
commands.registerCommandAlias("right", "k3DViewRight");
|
|
129
|
+
commands.registerCommandAlias("front", "k3DViewFront");
|
|
130
|
+
commands.registerCommandAlias("back", "k3DViewBack");
|
|
131
|
+
commands.registerCommandAlias("se", "k3DViewSE");
|
|
132
|
+
commands.registerCommandAlias("sw", "k3DViewSW");
|
|
133
|
+
commands.registerCommandAlias("ne", "k3DViewNE");
|
|
134
|
+
commands.registerCommandAlias("nw", "k3DViewNW");
|
|
@@ -31,15 +31,15 @@ export class CameraComponent implements IComponent {
|
|
|
31
31
|
this.viewer = viewer;
|
|
32
32
|
this.viewer.addEventListener("databasechunk", this.geometryEnd);
|
|
33
33
|
this.viewer.addEventListener("clear", this.geometryEnd);
|
|
34
|
-
this.viewer.addEventListener("optionschange", this.
|
|
35
|
-
this.viewer.addEventListener("initialize", this.
|
|
34
|
+
this.viewer.addEventListener("optionschange", this.syncOptions);
|
|
35
|
+
this.viewer.addEventListener("initialize", this.syncOptions);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
dispose() {
|
|
39
39
|
this.viewer.removeEventListener("databasechunk", this.geometryEnd);
|
|
40
40
|
this.viewer.removeEventListener("clear", this.geometryEnd);
|
|
41
|
-
this.viewer.removeEventListener("optionschange", this.
|
|
42
|
-
this.viewer.removeEventListener("initialize", this.
|
|
41
|
+
this.viewer.removeEventListener("optionschange", this.syncOptions);
|
|
42
|
+
this.viewer.removeEventListener("initialize", this.syncOptions);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
getCameraMode(view: any): CameraMode {
|
|
@@ -61,7 +61,7 @@ export class CameraComponent implements IComponent {
|
|
|
61
61
|
activeView.delete();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
syncOptions = () => {
|
|
65
65
|
this.switchCameraMode(this.viewer.options.cameraMode);
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -78,10 +78,10 @@ export class MeasureLineDragger extends OdBaseDragger {
|
|
|
78
78
|
this.m_overlayElement.style.pointerEvents = "none";
|
|
79
79
|
document.body.appendChild(this.m_overlayElement);
|
|
80
80
|
|
|
81
|
-
this.
|
|
81
|
+
this.updateUnits = this.updateUnits.bind(this);
|
|
82
82
|
this.updatePreview = this.updatePreview.bind(this);
|
|
83
83
|
|
|
84
|
-
this.subject.addEventListener("optionschange", this.
|
|
84
|
+
this.subject.addEventListener("optionschange", this.updateUnits);
|
|
85
85
|
this.subject.addEventListener("render", this.updatePreview);
|
|
86
86
|
|
|
87
87
|
this.resize();
|
|
@@ -92,7 +92,7 @@ export class MeasureLineDragger extends OdBaseDragger {
|
|
|
92
92
|
|
|
93
93
|
this.m_overlayElement.remove();
|
|
94
94
|
|
|
95
|
-
this.subject.removeEventListener("optionschange", this.
|
|
95
|
+
this.subject.removeEventListener("optionschange", this.updateUnits);
|
|
96
96
|
this.subject.removeEventListener("render", this.updatePreview);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -209,7 +209,7 @@ export class MeasureLineDragger extends OdBaseDragger {
|
|
|
209
209
|
return item;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
updateUnits(event): void {
|
|
213
213
|
const options: IOptions = event.data;
|
|
214
214
|
const toUnitName = options.rulerUnit ?? "Default";
|
|
215
215
|
const toPrecision = options.rulerPrecision ?? "Default";
|
|
@@ -59,10 +59,9 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
59
59
|
|
|
60
60
|
avp.addCuttingPlane(plane);
|
|
61
61
|
this.index = avp.numCuttingPlanes() - 1;
|
|
62
|
+
this.subject.syncOptions(); // <- sync cutting plane fill options
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
avp.setEnableCuttingPlaneFill(true, red, green, blue);
|
|
65
|
-
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
|
|
64
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
66
65
|
|
|
67
66
|
this.m_model = this.getModel();
|
|
68
67
|
this.createPreview();
|
|
@@ -115,6 +114,8 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
115
114
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
116
115
|
avp.updateCuttingPlane(this.index, plane);
|
|
117
116
|
|
|
117
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
118
|
+
|
|
118
119
|
this.drawPreview();
|
|
119
120
|
|
|
120
121
|
this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
|
|
@@ -136,6 +137,8 @@ export class OdBaseCuttingPlaneDragger extends OdBaseDragger {
|
|
|
136
137
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
137
138
|
avp.updateCuttingPlane(this.index, plane);
|
|
138
139
|
|
|
140
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
141
|
+
|
|
139
142
|
this.deleteAll([avp, plane, this.m_last]);
|
|
140
143
|
|
|
141
144
|
const device = this.getViewer().getActiveDevice();
|
|
@@ -25,7 +25,7 @@ import { OdBaseCuttingPlaneDragger } from "./OdBaseCuttingPlaneDragger";
|
|
|
25
25
|
|
|
26
26
|
export class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
27
27
|
override createNormal(): number[] {
|
|
28
|
-
return [0, 0, 1];
|
|
28
|
+
return [0, 0, -1];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
override handleDelta(delta: Point3d): Point3d {
|
package/src/Viewer/Viewer.ts
CHANGED
|
@@ -85,7 +85,6 @@ export class Viewer
|
|
|
85
85
|
private _activeDragger: IDragger | null;
|
|
86
86
|
private _components: IComponent[];
|
|
87
87
|
|
|
88
|
-
private _updateDelay: number;
|
|
89
88
|
private _renderNeeded: boolean;
|
|
90
89
|
private _renderTime: DOMHighResTimeStamp;
|
|
91
90
|
private _enableAutoUpdate: boolean;
|
|
@@ -131,7 +130,6 @@ export class Viewer
|
|
|
131
130
|
this._activeDragger = null;
|
|
132
131
|
this._components = [];
|
|
133
132
|
|
|
134
|
-
this._updateDelay = 1000;
|
|
135
133
|
this._renderNeeded = false;
|
|
136
134
|
this._renderTime = 0;
|
|
137
135
|
this._enableAutoUpdate = params.enableAutoUpdate ?? true;
|
|
@@ -300,9 +298,12 @@ export class Viewer
|
|
|
300
298
|
this.setActiveDragger();
|
|
301
299
|
|
|
302
300
|
this._components.forEach((component: IComponent) => component.dispose());
|
|
303
|
-
this._components =
|
|
301
|
+
this._components.length = 0;
|
|
304
302
|
|
|
305
|
-
this._markup
|
|
303
|
+
if (this._markup) {
|
|
304
|
+
this._markup.dispose();
|
|
305
|
+
this._markup = undefined;
|
|
306
|
+
}
|
|
306
307
|
|
|
307
308
|
if (this.canvas) {
|
|
308
309
|
this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
|
|
@@ -353,19 +354,20 @@ export class Viewer
|
|
|
353
354
|
* - {@link UpdateEvent | update}
|
|
354
355
|
* - {@link RenderEvent | render}
|
|
355
356
|
*
|
|
356
|
-
* @param force - If `true` updates the viewer immidietly.
|
|
357
|
-
*
|
|
357
|
+
* @param force - If `true` updates the viewer immidietly. If a `number` is specified and more than the
|
|
358
|
+
* given amount of milliseconds has elapsed since the last rendering, the update is performed
|
|
359
|
+
* immediately as well. Otherwise updates on next animation frame. Default is `false`.
|
|
358
360
|
*/
|
|
359
|
-
update(force = false) {
|
|
361
|
+
update(force: boolean | number = false) {
|
|
360
362
|
const time = performance.now();
|
|
361
|
-
|
|
363
|
+
if (typeof force === "number" && time - this._renderTime >= force) force = true;
|
|
362
364
|
|
|
363
365
|
if (this._enableAutoUpdate) {
|
|
364
366
|
this._renderNeeded = true;
|
|
365
367
|
if (force) this.render(time);
|
|
366
368
|
}
|
|
367
369
|
|
|
368
|
-
this.emitEvent({ type: "update", force });
|
|
370
|
+
this.emitEvent({ type: "update", force: !!force });
|
|
369
371
|
}
|
|
370
372
|
|
|
371
373
|
// Internal render routines
|
|
@@ -577,10 +579,10 @@ export class Viewer
|
|
|
577
579
|
this.clearSelected();
|
|
578
580
|
|
|
579
581
|
this.loaders.forEach((loader) => loader.dispose());
|
|
580
|
-
this.loaders =
|
|
582
|
+
this.loaders.length = 0;
|
|
581
583
|
|
|
582
584
|
this.models.forEach((model) => model.dispose());
|
|
583
|
-
this.models =
|
|
585
|
+
this.models.length = 0;
|
|
584
586
|
|
|
585
587
|
visViewer.clear();
|
|
586
588
|
visViewer.createLocalDatabase();
|
|
@@ -712,6 +714,23 @@ export class Viewer
|
|
|
712
714
|
activeView.delete();
|
|
713
715
|
}
|
|
714
716
|
|
|
717
|
+
// sync cutting plane fill options
|
|
718
|
+
|
|
719
|
+
view.setEnableCuttingPlaneFill(
|
|
720
|
+
options.enableSectionFill,
|
|
721
|
+
options.sectionFillColor.r,
|
|
722
|
+
options.sectionFillColor.g,
|
|
723
|
+
options.sectionFillColor.b
|
|
724
|
+
);
|
|
725
|
+
|
|
726
|
+
view.setCuttingPlaneFillPatternEnabled(
|
|
727
|
+
options.enableSectionHatch,
|
|
728
|
+
visLib.CuttingPlaneFillStyle.kSlantRight,
|
|
729
|
+
options.sectionHatchColor.r,
|
|
730
|
+
options.sectionHatchColor.g,
|
|
731
|
+
options.sectionHatchColor.b
|
|
732
|
+
);
|
|
733
|
+
|
|
715
734
|
// sync highlighting options
|
|
716
735
|
|
|
717
736
|
const params = options.enableCustomHighlight ? options : Options.defaults();
|
|
@@ -814,6 +833,7 @@ export class Viewer
|
|
|
814
833
|
activeView.removeCuttingPlanes();
|
|
815
834
|
activeView.delete();
|
|
816
835
|
|
|
836
|
+
this.emitEvent({ type: "changecuttingplanes" });
|
|
817
837
|
this.emitEvent({ type: "clearslices" });
|
|
818
838
|
this.update();
|
|
819
839
|
}
|
|
@@ -973,6 +993,8 @@ export class Viewer
|
|
|
973
993
|
activeView.addCuttingPlane(cuttingPlane);
|
|
974
994
|
activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
|
|
975
995
|
}
|
|
996
|
+
|
|
997
|
+
this.emitEvent({ type: "changecuttingplanes" });
|
|
976
998
|
}
|
|
977
999
|
};
|
|
978
1000
|
|
|
@@ -985,8 +1007,8 @@ export class Viewer
|
|
|
985
1007
|
this.setActiveDragger();
|
|
986
1008
|
this.clearSlices();
|
|
987
1009
|
this.clearOverlay();
|
|
988
|
-
|
|
989
1010
|
this.clearSelected();
|
|
1011
|
+
|
|
990
1012
|
this.showAll();
|
|
991
1013
|
this.explode();
|
|
992
1014
|
|