@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
package/dist/viewer-visualize.js
CHANGED
|
@@ -235,6 +235,15 @@
|
|
|
235
235
|
enablePartialMode: false,
|
|
236
236
|
memoryLimit: 3294967296,
|
|
237
237
|
cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
|
|
238
|
+
enableSectionFill: true,
|
|
239
|
+
sectionFillColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
240
|
+
sectionUseObjectColor: false,
|
|
241
|
+
enableSectionHatch: true,
|
|
242
|
+
sectionHatchColor: { r: 0, g: 0, b: 0 },
|
|
243
|
+
sectionHatchScale: 8,
|
|
244
|
+
enableSectionOutline: true,
|
|
245
|
+
sectionOutlineColor: { r: 0, g: 0, b: 0 },
|
|
246
|
+
sectionOutlineWidth: 2,
|
|
238
247
|
edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
239
248
|
facesColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
240
249
|
edgesVisibility: true,
|
|
@@ -309,9 +318,17 @@
|
|
|
309
318
|
return this._data;
|
|
310
319
|
}
|
|
311
320
|
set data(value) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
321
|
+
this._data = { ...Options.defaults(), ...this._data, ...value };
|
|
322
|
+
if (this._data.enablePartialMode) {
|
|
323
|
+
this._data.enableStreamingMode = true;
|
|
324
|
+
this._data.sceneGraph = false;
|
|
325
|
+
}
|
|
326
|
+
if (!value.sectionFillColor && value.cuttingPlaneFillColor)
|
|
327
|
+
this._data.sectionFillColor = {
|
|
328
|
+
r: value.cuttingPlaneFillColor.red,
|
|
329
|
+
g: value.cuttingPlaneFillColor.green,
|
|
330
|
+
b: value.cuttingPlaneFillColor.blue,
|
|
331
|
+
};
|
|
315
332
|
this.change();
|
|
316
333
|
}
|
|
317
334
|
get showWCS() {
|
|
@@ -398,10 +415,83 @@
|
|
|
398
415
|
this.change();
|
|
399
416
|
}
|
|
400
417
|
get cuttingPlaneFillColor() {
|
|
401
|
-
|
|
418
|
+
console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
|
|
419
|
+
return {
|
|
420
|
+
red: this._data.sectionFillColor.r,
|
|
421
|
+
green: this._data.sectionFillColor.g,
|
|
422
|
+
blue: this._data.sectionFillColor.b,
|
|
423
|
+
};
|
|
402
424
|
}
|
|
403
425
|
set cuttingPlaneFillColor(value) {
|
|
404
|
-
|
|
426
|
+
console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
|
|
427
|
+
this._data.sectionFillColor = {
|
|
428
|
+
r: value.red,
|
|
429
|
+
g: value.green,
|
|
430
|
+
b: value.blue,
|
|
431
|
+
};
|
|
432
|
+
this.change();
|
|
433
|
+
}
|
|
434
|
+
get enableSectionFill() {
|
|
435
|
+
return this._data.enableSectionFill;
|
|
436
|
+
}
|
|
437
|
+
set enableSectionFill(value) {
|
|
438
|
+
this._data.enableSectionFill = value;
|
|
439
|
+
this.change();
|
|
440
|
+
}
|
|
441
|
+
get sectionFillColor() {
|
|
442
|
+
return this._data.sectionFillColor;
|
|
443
|
+
}
|
|
444
|
+
set sectionFillColor(value) {
|
|
445
|
+
this._data.sectionFillColor = value;
|
|
446
|
+
this.change();
|
|
447
|
+
}
|
|
448
|
+
get sectionUseObjectColor() {
|
|
449
|
+
return this._data.sectionUseObjectColor;
|
|
450
|
+
}
|
|
451
|
+
set sectionUseObjectColor(value) {
|
|
452
|
+
this._data.sectionUseObjectColor = value;
|
|
453
|
+
this.change();
|
|
454
|
+
}
|
|
455
|
+
get enableSectionHatch() {
|
|
456
|
+
return this._data.enableSectionHatch;
|
|
457
|
+
}
|
|
458
|
+
set enableSectionHatch(value) {
|
|
459
|
+
this._data.enableSectionHatch = value;
|
|
460
|
+
this.change();
|
|
461
|
+
}
|
|
462
|
+
get sectionHatchColor() {
|
|
463
|
+
return this._data.sectionHatchColor;
|
|
464
|
+
}
|
|
465
|
+
set sectionHatchColor(value) {
|
|
466
|
+
this._data.sectionHatchColor = value;
|
|
467
|
+
this.change();
|
|
468
|
+
}
|
|
469
|
+
get sectionHatchScale() {
|
|
470
|
+
return this._data.sectionHatchScale;
|
|
471
|
+
}
|
|
472
|
+
set sectionHatchScale(value) {
|
|
473
|
+
this._data.sectionHatchScale = value;
|
|
474
|
+
this.change();
|
|
475
|
+
}
|
|
476
|
+
get enableSectionOutline() {
|
|
477
|
+
return this._data.enableSectionOutline;
|
|
478
|
+
}
|
|
479
|
+
set enableSectionOutline(value) {
|
|
480
|
+
this._data.enableSectionOutline = value;
|
|
481
|
+
this.change();
|
|
482
|
+
}
|
|
483
|
+
get sectionOutlineColor() {
|
|
484
|
+
return this._data.sectionOutlineColor;
|
|
485
|
+
}
|
|
486
|
+
set sectionOutlineColor(value) {
|
|
487
|
+
this._data.sectionOutlineColor = value;
|
|
488
|
+
this.change();
|
|
489
|
+
}
|
|
490
|
+
get sectionOutlineWidth() {
|
|
491
|
+
return this._data.sectionOutlineWidth;
|
|
492
|
+
}
|
|
493
|
+
set sectionOutlineWidth(value) {
|
|
494
|
+
this._data.sectionOutlineWidth = value;
|
|
405
495
|
this.change();
|
|
406
496
|
}
|
|
407
497
|
get edgesColor() {
|
|
@@ -1209,16 +1299,16 @@
|
|
|
1209
1299
|
this.m_overlayElement.style.zIndex = "1";
|
|
1210
1300
|
this.m_overlayElement.style.pointerEvents = "none";
|
|
1211
1301
|
document.body.appendChild(this.m_overlayElement);
|
|
1212
|
-
this.
|
|
1302
|
+
this.updateUnits = this.updateUnits.bind(this);
|
|
1213
1303
|
this.updatePreview = this.updatePreview.bind(this);
|
|
1214
|
-
this.subject.addEventListener("optionschange", this.
|
|
1304
|
+
this.subject.addEventListener("optionschange", this.updateUnits);
|
|
1215
1305
|
this.subject.addEventListener("render", this.updatePreview);
|
|
1216
1306
|
this.resize();
|
|
1217
1307
|
}
|
|
1218
1308
|
dispose() {
|
|
1219
1309
|
super.dispose();
|
|
1220
1310
|
this.m_overlayElement.remove();
|
|
1221
|
-
this.subject.removeEventListener("optionschange", this.
|
|
1311
|
+
this.subject.removeEventListener("optionschange", this.updateUnits);
|
|
1222
1312
|
this.subject.removeEventListener("render", this.updatePreview);
|
|
1223
1313
|
}
|
|
1224
1314
|
updatePreview() {
|
|
@@ -1320,7 +1410,7 @@
|
|
|
1320
1410
|
this.items.push(item);
|
|
1321
1411
|
return item;
|
|
1322
1412
|
}
|
|
1323
|
-
|
|
1413
|
+
updateUnits(event) {
|
|
1324
1414
|
var _a, _b;
|
|
1325
1415
|
const options = event.data;
|
|
1326
1416
|
const toUnitName = (_a = options.rulerUnit) !== null && _a !== void 0 ? _a : "Default";
|
|
@@ -2103,9 +2193,8 @@
|
|
|
2103
2193
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
2104
2194
|
avp.addCuttingPlane(plane);
|
|
2105
2195
|
this.index = avp.numCuttingPlanes() - 1;
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
avp.setCuttingPlaneFillPatternEnabled(true, this.m_module.CuttingPlaneFillStyle.kSlantRight, 0x0, 0x0, 0x0);
|
|
2196
|
+
this.subject.syncOptions();
|
|
2197
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
2109
2198
|
this.m_model = this.getModel();
|
|
2110
2199
|
this.createPreview();
|
|
2111
2200
|
this.deleteAll([ext, avp, plane]);
|
|
@@ -2145,6 +2234,7 @@
|
|
|
2145
2234
|
const plane = this.createPlane();
|
|
2146
2235
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
2147
2236
|
avp.updateCuttingPlane(this.index, plane);
|
|
2237
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
2148
2238
|
this.drawPreview();
|
|
2149
2239
|
this.deleteAll([avp, plane, oldCenter, delta, oldLast]);
|
|
2150
2240
|
const device = this.getViewer().getActiveDevice();
|
|
@@ -2160,6 +2250,7 @@
|
|
|
2160
2250
|
const plane = this.createPlane();
|
|
2161
2251
|
plane.set(this.toGePoint(this.m_center), this.m_normal);
|
|
2162
2252
|
avp.updateCuttingPlane(this.index, plane);
|
|
2253
|
+
this.subject.emitEvent({ type: "changecuttingplanes" });
|
|
2163
2254
|
this.deleteAll([avp, plane, this.m_last]);
|
|
2164
2255
|
const device = this.getViewer().getActiveDevice();
|
|
2165
2256
|
device.invalidate(device.getSize());
|
|
@@ -2245,7 +2336,7 @@
|
|
|
2245
2336
|
|
|
2246
2337
|
class OdCuttingPlaneZAxisDragger extends OdBaseCuttingPlaneDragger {
|
|
2247
2338
|
createNormal() {
|
|
2248
|
-
return [0, 0, 1];
|
|
2339
|
+
return [0, 0, -1];
|
|
2249
2340
|
}
|
|
2250
2341
|
handleDelta(delta) {
|
|
2251
2342
|
delta.x = 0.0;
|
|
@@ -3410,24 +3501,34 @@
|
|
|
3410
3501
|
commands.registerCommand("zoomToObjects", zoomToObjects);
|
|
3411
3502
|
commands.registerCommand("zoomToSelected", zoomToSelected);
|
|
3412
3503
|
commands.registerCommand("autoTransformAllModelsToCentralPoint", autoTransformAllModelsToCentralPoint);
|
|
3413
|
-
commands.registerCommand("
|
|
3414
|
-
commands.registerCommand("
|
|
3415
|
-
commands.registerCommand("
|
|
3416
|
-
commands.registerCommand("
|
|
3417
|
-
commands.registerCommand("
|
|
3418
|
-
commands.registerCommand("
|
|
3419
|
-
commands.registerCommand("
|
|
3420
|
-
commands.registerCommand("
|
|
3421
|
-
commands.registerCommand("
|
|
3422
|
-
commands.registerCommand("
|
|
3504
|
+
commands.registerCommand("top", (viewer) => setDefaultViewPosition(viewer, "k3DViewTop"));
|
|
3505
|
+
commands.registerCommand("bottom", (viewer) => setDefaultViewPosition(viewer, "k3DViewBottom"));
|
|
3506
|
+
commands.registerCommand("left", (viewer) => setDefaultViewPosition(viewer, "k3DViewLeft"));
|
|
3507
|
+
commands.registerCommand("right", (viewer) => setDefaultViewPosition(viewer, "k3DViewRight"));
|
|
3508
|
+
commands.registerCommand("front", (viewer) => setDefaultViewPosition(viewer, "k3DViewFront"));
|
|
3509
|
+
commands.registerCommand("back", (viewer) => setDefaultViewPosition(viewer, "k3DViewBack"));
|
|
3510
|
+
commands.registerCommand("se", (viewer) => setDefaultViewPosition(viewer, "k3DViewSE"));
|
|
3511
|
+
commands.registerCommand("sw", (viewer) => setDefaultViewPosition(viewer, "k3DViewSW"));
|
|
3512
|
+
commands.registerCommand("ne", (viewer) => setDefaultViewPosition(viewer, "k3DViewNE"));
|
|
3513
|
+
commands.registerCommand("nw", (viewer) => setDefaultViewPosition(viewer, "k3DViewNW"));
|
|
3423
3514
|
commands.registerCommandAlias("clearMarkup", "clearOverlay");
|
|
3424
3515
|
commands.registerCommandAlias("clearSelected", "unselect");
|
|
3425
3516
|
commands.registerCommandAlias("getSnapshot", "createPreview");
|
|
3426
3517
|
commands.registerCommandAlias("zoomToExtents", "zoomExtents");
|
|
3518
|
+
commands.registerCommandAlias("top", "k3DViewTop");
|
|
3519
|
+
commands.registerCommandAlias("bottom", "k3DViewBottom");
|
|
3520
|
+
commands.registerCommandAlias("left", "k3DViewLeft");
|
|
3521
|
+
commands.registerCommandAlias("right", "k3DViewRight");
|
|
3522
|
+
commands.registerCommandAlias("front", "k3DViewFront");
|
|
3523
|
+
commands.registerCommandAlias("back", "k3DViewBack");
|
|
3524
|
+
commands.registerCommandAlias("se", "k3DViewSE");
|
|
3525
|
+
commands.registerCommandAlias("sw", "k3DViewSW");
|
|
3526
|
+
commands.registerCommandAlias("ne", "k3DViewNE");
|
|
3527
|
+
commands.registerCommandAlias("nw", "k3DViewNW");
|
|
3427
3528
|
|
|
3428
3529
|
class CameraComponent {
|
|
3429
3530
|
constructor(viewer) {
|
|
3430
|
-
this.
|
|
3531
|
+
this.syncOptions = () => {
|
|
3431
3532
|
this.switchCameraMode(this.viewer.options.cameraMode);
|
|
3432
3533
|
};
|
|
3433
3534
|
this.geometryEnd = () => {
|
|
@@ -3440,14 +3541,14 @@
|
|
|
3440
3541
|
this.viewer = viewer;
|
|
3441
3542
|
this.viewer.addEventListener("databasechunk", this.geometryEnd);
|
|
3442
3543
|
this.viewer.addEventListener("clear", this.geometryEnd);
|
|
3443
|
-
this.viewer.addEventListener("optionschange", this.
|
|
3444
|
-
this.viewer.addEventListener("initialize", this.
|
|
3544
|
+
this.viewer.addEventListener("optionschange", this.syncOptions);
|
|
3545
|
+
this.viewer.addEventListener("initialize", this.syncOptions);
|
|
3445
3546
|
}
|
|
3446
3547
|
dispose() {
|
|
3447
3548
|
this.viewer.removeEventListener("databasechunk", this.geometryEnd);
|
|
3448
3549
|
this.viewer.removeEventListener("clear", this.geometryEnd);
|
|
3449
|
-
this.viewer.removeEventListener("optionschange", this.
|
|
3450
|
-
this.viewer.removeEventListener("initialize", this.
|
|
3550
|
+
this.viewer.removeEventListener("optionschange", this.syncOptions);
|
|
3551
|
+
this.viewer.removeEventListener("initialize", this.syncOptions);
|
|
3451
3552
|
}
|
|
3452
3553
|
getCameraMode(view) {
|
|
3453
3554
|
return view.perspective ? "perspective" : "orthographic";
|
|
@@ -4186,7 +4287,7 @@
|
|
|
4186
4287
|
}
|
|
4187
4288
|
else {
|
|
4188
4289
|
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
|
|
4189
|
-
this.viewer.update();
|
|
4290
|
+
this.viewer.update(500);
|
|
4190
4291
|
}
|
|
4191
4292
|
};
|
|
4192
4293
|
await model.downloadResource(model.database, chunkLoadHandler, this.abortController.signal);
|
|
@@ -4244,7 +4345,7 @@
|
|
|
4244
4345
|
}
|
|
4245
4346
|
else {
|
|
4246
4347
|
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
|
|
4247
|
-
this.viewer.update();
|
|
4348
|
+
this.viewer.update(500);
|
|
4248
4349
|
}
|
|
4249
4350
|
};
|
|
4250
4351
|
const downloadResourceRange = async (dataId, requestId, ranges) => {
|
|
@@ -18262,7 +18363,6 @@ js: import "konva/skia-backend";
|
|
|
18262
18363
|
this.canvaseventlistener = (event) => this.emit(event);
|
|
18263
18364
|
this._activeDragger = null;
|
|
18264
18365
|
this._components = [];
|
|
18265
|
-
this._updateDelay = 1000;
|
|
18266
18366
|
this._renderNeeded = false;
|
|
18267
18367
|
this._renderTime = 0;
|
|
18268
18368
|
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
|
|
@@ -18287,7 +18387,7 @@ js: import "konva/skia-backend";
|
|
|
18287
18387
|
return this._markup;
|
|
18288
18388
|
}
|
|
18289
18389
|
configure(params) {
|
|
18290
|
-
this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/
|
|
18390
|
+
this._visualizeJsUrl = params.visualizeJsUrl || "https://public-fhemb7e3embacwec.z02.azurefd.net/libs/visualizejs/master/Visualize.js";
|
|
18291
18391
|
this._crossOrigin = params.crossOrigin;
|
|
18292
18392
|
return this;
|
|
18293
18393
|
}
|
|
@@ -18343,8 +18443,11 @@ js: import "konva/skia-backend";
|
|
|
18343
18443
|
this.removeAllListeners();
|
|
18344
18444
|
this.setActiveDragger();
|
|
18345
18445
|
this._components.forEach((component) => component.dispose());
|
|
18346
|
-
this._components =
|
|
18347
|
-
this._markup
|
|
18446
|
+
this._components.length = 0;
|
|
18447
|
+
if (this._markup) {
|
|
18448
|
+
this._markup.dispose();
|
|
18449
|
+
this._markup = undefined;
|
|
18450
|
+
}
|
|
18348
18451
|
if (this.canvas) {
|
|
18349
18452
|
this.canvasEvents.forEach((x) => this.canvas.removeEventListener(x, this.canvaseventlistener));
|
|
18350
18453
|
this.canvas = undefined;
|
|
@@ -18374,13 +18477,14 @@ js: import "konva/skia-backend";
|
|
|
18374
18477
|
}
|
|
18375
18478
|
update(force = false) {
|
|
18376
18479
|
const time = performance.now();
|
|
18377
|
-
|
|
18480
|
+
if (typeof force === "number" && time - this._renderTime >= force)
|
|
18481
|
+
force = true;
|
|
18378
18482
|
if (this._enableAutoUpdate) {
|
|
18379
18483
|
this._renderNeeded = true;
|
|
18380
18484
|
if (force)
|
|
18381
18485
|
this.render(time);
|
|
18382
18486
|
}
|
|
18383
|
-
this.emitEvent({ type: "update", force });
|
|
18487
|
+
this.emitEvent({ type: "update", force: !!force });
|
|
18384
18488
|
}
|
|
18385
18489
|
render(time) {
|
|
18386
18490
|
if (!this.visualizeJs)
|
|
@@ -18494,9 +18598,9 @@ js: import "konva/skia-backend";
|
|
|
18494
18598
|
this.clearOverlay();
|
|
18495
18599
|
this.clearSelected();
|
|
18496
18600
|
this.loaders.forEach((loader) => loader.dispose());
|
|
18497
|
-
this.loaders =
|
|
18601
|
+
this.loaders.length = 0;
|
|
18498
18602
|
this.models.forEach((model) => model.dispose());
|
|
18499
|
-
this.models =
|
|
18603
|
+
this.models.length = 0;
|
|
18500
18604
|
visViewer.clear();
|
|
18501
18605
|
visViewer.createLocalDatabase();
|
|
18502
18606
|
this.syncOptions();
|
|
@@ -18586,6 +18690,8 @@ js: import "konva/skia-backend";
|
|
|
18586
18690
|
visualStyleId.delete();
|
|
18587
18691
|
activeView.delete();
|
|
18588
18692
|
}
|
|
18693
|
+
view.setEnableCuttingPlaneFill(options.enableSectionFill, options.sectionFillColor.r, options.sectionFillColor.g, options.sectionFillColor.b);
|
|
18694
|
+
view.setCuttingPlaneFillPatternEnabled(options.enableSectionHatch, visLib.CuttingPlaneFillStyle.kSlantRight, options.sectionHatchColor.r, options.sectionHatchColor.g, options.sectionHatchColor.b);
|
|
18589
18695
|
const params = options.enableCustomHighlight ? options : Options.defaults();
|
|
18590
18696
|
const { Entry, OdTvRGBColorDef } = visLib;
|
|
18591
18697
|
const highlightStyleId = visViewer.findHighlightStyle("Web_Default");
|
|
@@ -18657,6 +18763,7 @@ js: import "konva/skia-backend";
|
|
|
18657
18763
|
const activeView = visViewer.activeView;
|
|
18658
18764
|
activeView.removeCuttingPlanes();
|
|
18659
18765
|
activeView.delete();
|
|
18766
|
+
this.emitEvent({ type: "changecuttingplanes" });
|
|
18660
18767
|
this.emitEvent({ type: "clearslices" });
|
|
18661
18768
|
this.update();
|
|
18662
18769
|
}
|
|
@@ -18768,6 +18875,7 @@ js: import "konva/skia-backend";
|
|
|
18768
18875
|
activeView.addCuttingPlane(cuttingPlane);
|
|
18769
18876
|
activeView.setEnableCuttingPlaneFill(true, 0x66, 0x66, 0x66);
|
|
18770
18877
|
}
|
|
18878
|
+
this.emitEvent({ type: "changecuttingplanes" });
|
|
18771
18879
|
}
|
|
18772
18880
|
};
|
|
18773
18881
|
const setSelection = (selection) => {
|