@inweb/viewer-core 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-core.js +157 -78
- package/dist/viewer-core.js.map +1 -1
- package/dist/viewer-core.module.js +157 -78
- package/dist/viewer-core.module.js.map +1 -1
- package/lib/options/IOptions.d.ts +99 -32
- package/lib/options/Options.d.ts +53 -6
- package/lib/viewer/IViewer.d.ts +5 -3
- package/lib/viewer/IViewpoint.d.ts +15 -5
- package/lib/viewer/ViewerEvents.d.ts +17 -0
- package/package.json +3 -3
- package/src/loaders/Loader.ts +4 -5
- package/src/loaders/Loaders.ts +1 -1
- package/src/options/IOptions.ts +105 -33
- package/src/options/Options.ts +201 -99
- package/src/viewer/IViewer.ts +5 -3
- package/src/viewer/IViewpoint.ts +15 -6
- package/src/viewer/ViewerEvents.ts +19 -0
package/dist/viewer-core.js
CHANGED
|
@@ -164,8 +164,7 @@
|
|
|
164
164
|
this.abortController = new AbortController();
|
|
165
165
|
}
|
|
166
166
|
dispose() {
|
|
167
|
-
this.
|
|
168
|
-
this.abortController = undefined;
|
|
167
|
+
this.cancel();
|
|
169
168
|
}
|
|
170
169
|
isSupport(file, format) {
|
|
171
170
|
return false;
|
|
@@ -184,10 +183,10 @@
|
|
|
184
183
|
extractFileName(file) {
|
|
185
184
|
const regex = /[^/\\?#:]+(?=\?|#|$)/;
|
|
186
185
|
if (typeof file === "string")
|
|
187
|
-
return (file.match(regex) || [])[0];
|
|
186
|
+
return (file.match(regex) || [])[0] || "";
|
|
188
187
|
else if (file instanceof globalThis.File)
|
|
189
|
-
return (file.name.match(regex) || [])[0];
|
|
190
|
-
return
|
|
188
|
+
return (file.name.match(regex) || [])[0] || "";
|
|
189
|
+
return "";
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
|
|
@@ -242,6 +241,15 @@
|
|
|
242
241
|
enablePartialMode: false,
|
|
243
242
|
memoryLimit: 3294967296,
|
|
244
243
|
cuttingPlaneFillColor: { red: 0xff, green: 0x98, blue: 0x00 },
|
|
244
|
+
enableSectionFill: true,
|
|
245
|
+
sectionFillColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
246
|
+
sectionUseObjectColor: false,
|
|
247
|
+
enableSectionHatch: true,
|
|
248
|
+
sectionHatchColor: { r: 0, g: 0, b: 0 },
|
|
249
|
+
sectionHatchScale: 8,
|
|
250
|
+
enableSectionOutline: true,
|
|
251
|
+
sectionOutlineColor: { r: 0, g: 0, b: 0 },
|
|
252
|
+
sectionOutlineWidth: 2,
|
|
245
253
|
edgesColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
246
254
|
facesColor: { r: 0xff, g: 0x98, b: 0x00 },
|
|
247
255
|
edgesVisibility: true,
|
|
@@ -301,230 +309,301 @@
|
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
311
|
resetToDefaults(fields) {
|
|
312
|
+
const defaults = Options.defaults();
|
|
304
313
|
if (fields !== undefined) {
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
this.data =
|
|
314
|
+
const resetData = {};
|
|
315
|
+
for (const field of fields) {
|
|
316
|
+
if (field in defaults)
|
|
317
|
+
resetData[field] = defaults[field];
|
|
318
|
+
}
|
|
319
|
+
this.data = resetData;
|
|
311
320
|
}
|
|
312
321
|
else {
|
|
313
|
-
this.data =
|
|
322
|
+
this.data = defaults;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
setProperty(key, value = Options.defaults()[key]) {
|
|
326
|
+
if (this._data[key] !== value) {
|
|
327
|
+
this._data[key] = value;
|
|
328
|
+
this.change();
|
|
314
329
|
}
|
|
315
330
|
}
|
|
316
331
|
get data() {
|
|
317
332
|
return this._data;
|
|
318
333
|
}
|
|
319
334
|
set data(value) {
|
|
320
|
-
const
|
|
321
|
-
const
|
|
322
|
-
|
|
335
|
+
const defaults = Options.defaults();
|
|
336
|
+
const merged = { ...defaults, ...this._data, ...value };
|
|
337
|
+
for (const key of Object.keys(defaults)) {
|
|
338
|
+
if (merged[key] === undefined)
|
|
339
|
+
merged[key] = defaults[key];
|
|
340
|
+
}
|
|
341
|
+
this._data = merged;
|
|
342
|
+
if (this._data.enablePartialMode) {
|
|
343
|
+
this._data.enableStreamingMode = true;
|
|
344
|
+
this._data.sceneGraph = false;
|
|
345
|
+
}
|
|
346
|
+
if (!value.sectionFillColor && value.cuttingPlaneFillColor)
|
|
347
|
+
this._data.sectionFillColor = {
|
|
348
|
+
r: value.cuttingPlaneFillColor.red,
|
|
349
|
+
g: value.cuttingPlaneFillColor.green,
|
|
350
|
+
b: value.cuttingPlaneFillColor.blue,
|
|
351
|
+
};
|
|
323
352
|
this.change();
|
|
324
353
|
}
|
|
325
354
|
get showWCS() {
|
|
326
355
|
return this._data.showWCS;
|
|
327
356
|
}
|
|
328
357
|
set showWCS(value) {
|
|
329
|
-
this.
|
|
330
|
-
this.change();
|
|
358
|
+
this.setProperty("showWCS", value);
|
|
331
359
|
}
|
|
332
360
|
get cameraAnimation() {
|
|
333
361
|
return this._data.cameraAnimation;
|
|
334
362
|
}
|
|
335
363
|
set cameraAnimation(value) {
|
|
336
|
-
this.
|
|
337
|
-
this.change();
|
|
364
|
+
this.setProperty("cameraAnimation", value);
|
|
338
365
|
}
|
|
339
366
|
get antialiasing() {
|
|
340
367
|
return this._data.antialiasing;
|
|
341
368
|
}
|
|
342
369
|
set antialiasing(value) {
|
|
343
|
-
this.
|
|
344
|
-
this.change();
|
|
370
|
+
this.setProperty("antialiasing", value);
|
|
345
371
|
}
|
|
346
372
|
get groundShadow() {
|
|
347
373
|
return this._data.groundShadow;
|
|
348
374
|
}
|
|
349
375
|
set groundShadow(value) {
|
|
350
|
-
this.
|
|
351
|
-
this.change();
|
|
376
|
+
this.setProperty("groundShadow", value);
|
|
352
377
|
}
|
|
353
378
|
get shadows() {
|
|
354
379
|
return this._data.shadows;
|
|
355
380
|
}
|
|
356
381
|
set shadows(value) {
|
|
357
|
-
this.
|
|
358
|
-
this.change();
|
|
382
|
+
this.setProperty("shadows", value);
|
|
359
383
|
}
|
|
360
384
|
get cameraAxisXSpeed() {
|
|
361
385
|
return this._data.cameraAxisXSpeed;
|
|
362
386
|
}
|
|
363
387
|
set cameraAxisXSpeed(value) {
|
|
364
|
-
this.
|
|
365
|
-
this.change();
|
|
388
|
+
this.setProperty("cameraAxisXSpeed", value);
|
|
366
389
|
}
|
|
367
390
|
get cameraAxisYSpeed() {
|
|
368
391
|
return this._data.cameraAxisYSpeed;
|
|
369
392
|
}
|
|
370
393
|
set cameraAxisYSpeed(value) {
|
|
371
|
-
this.cameraAxisYSpeed
|
|
372
|
-
this.change();
|
|
394
|
+
this.setProperty("cameraAxisYSpeed", value);
|
|
373
395
|
}
|
|
374
396
|
get ambientOcclusion() {
|
|
375
397
|
return this._data.ambientOcclusion;
|
|
376
398
|
}
|
|
377
399
|
set ambientOcclusion(value) {
|
|
378
|
-
this.
|
|
379
|
-
this.change();
|
|
400
|
+
this.setProperty("ambientOcclusion", value);
|
|
380
401
|
}
|
|
381
402
|
get enableStreamingMode() {
|
|
382
403
|
return this._data.enableStreamingMode;
|
|
383
404
|
}
|
|
384
405
|
set enableStreamingMode(value) {
|
|
385
|
-
this.
|
|
386
|
-
if (!value)
|
|
387
|
-
this.
|
|
388
|
-
|
|
406
|
+
this.setProperty("enableStreamingMode", value);
|
|
407
|
+
if (!value) {
|
|
408
|
+
this.setProperty("enablePartialMode", false);
|
|
409
|
+
}
|
|
389
410
|
}
|
|
390
411
|
get enablePartialMode() {
|
|
391
412
|
return this._data.enablePartialMode;
|
|
392
413
|
}
|
|
393
414
|
set enablePartialMode(value) {
|
|
394
|
-
this.
|
|
415
|
+
this.setProperty("enablePartialMode", value);
|
|
395
416
|
if (value) {
|
|
396
|
-
this.
|
|
397
|
-
this.
|
|
417
|
+
this.setProperty("enableStreamingMode", true);
|
|
418
|
+
this.setProperty("sceneGraph", false);
|
|
398
419
|
}
|
|
399
|
-
this.change();
|
|
400
420
|
}
|
|
401
421
|
get memoryLimit() {
|
|
402
422
|
return this._data.memoryLimit;
|
|
403
423
|
}
|
|
404
424
|
set memoryLimit(value) {
|
|
405
|
-
this.
|
|
406
|
-
this.change();
|
|
425
|
+
this.setProperty("memoryLimit", value);
|
|
407
426
|
}
|
|
408
427
|
get cuttingPlaneFillColor() {
|
|
409
|
-
|
|
428
|
+
console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
|
|
429
|
+
return {
|
|
430
|
+
red: this._data.sectionFillColor.r,
|
|
431
|
+
green: this._data.sectionFillColor.g,
|
|
432
|
+
blue: this._data.sectionFillColor.b,
|
|
433
|
+
};
|
|
410
434
|
}
|
|
411
435
|
set cuttingPlaneFillColor(value) {
|
|
412
|
-
|
|
413
|
-
this.
|
|
436
|
+
console.warn("Options.cuttingPlaneFillColor has been deprecated since 27.5 and will be removed in a future release, use sectionFillColor instead");
|
|
437
|
+
this.setProperty("sectionFillColor", {
|
|
438
|
+
r: value.red,
|
|
439
|
+
g: value.green,
|
|
440
|
+
b: value.blue,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
get enableSectionFill() {
|
|
444
|
+
return this._data.enableSectionFill;
|
|
445
|
+
}
|
|
446
|
+
set enableSectionFill(value) {
|
|
447
|
+
this.setProperty("enableSectionFill", value);
|
|
448
|
+
}
|
|
449
|
+
get sectionFillColor() {
|
|
450
|
+
return this._data.sectionFillColor;
|
|
451
|
+
}
|
|
452
|
+
set sectionFillColor(value) {
|
|
453
|
+
this.setProperty("sectionFillColor", value);
|
|
454
|
+
}
|
|
455
|
+
get sectionUseObjectColor() {
|
|
456
|
+
return this._data.sectionUseObjectColor;
|
|
457
|
+
}
|
|
458
|
+
set sectionUseObjectColor(value) {
|
|
459
|
+
this.setProperty("sectionUseObjectColor", value);
|
|
460
|
+
}
|
|
461
|
+
get enableSectionHatch() {
|
|
462
|
+
return this._data.enableSectionHatch;
|
|
463
|
+
}
|
|
464
|
+
set enableSectionHatch(value) {
|
|
465
|
+
this.setProperty("enableSectionHatch", value);
|
|
466
|
+
}
|
|
467
|
+
get sectionHatchColor() {
|
|
468
|
+
return this._data.sectionHatchColor;
|
|
469
|
+
}
|
|
470
|
+
set sectionHatchColor(value) {
|
|
471
|
+
this.setProperty("sectionHatchColor", value);
|
|
472
|
+
}
|
|
473
|
+
get sectionHatchScale() {
|
|
474
|
+
return this._data.sectionHatchScale;
|
|
475
|
+
}
|
|
476
|
+
set sectionHatchScale(value) {
|
|
477
|
+
this.setProperty("sectionHatchScale", value);
|
|
478
|
+
}
|
|
479
|
+
get enableSectionOutline() {
|
|
480
|
+
return this._data.enableSectionOutline;
|
|
481
|
+
}
|
|
482
|
+
set enableSectionOutline(value) {
|
|
483
|
+
this.setProperty("enableSectionOutline", value);
|
|
484
|
+
}
|
|
485
|
+
get sectionOutlineColor() {
|
|
486
|
+
return this._data.sectionOutlineColor;
|
|
487
|
+
}
|
|
488
|
+
set sectionOutlineColor(value) {
|
|
489
|
+
this.setProperty("sectionOutlineColor", value);
|
|
490
|
+
}
|
|
491
|
+
get sectionOutlineWidth() {
|
|
492
|
+
return this._data.sectionOutlineWidth;
|
|
493
|
+
}
|
|
494
|
+
set sectionOutlineWidth(value) {
|
|
495
|
+
this.setProperty("sectionOutlineWidth", value);
|
|
414
496
|
}
|
|
415
497
|
get edgesColor() {
|
|
416
498
|
return this._data.edgesColor;
|
|
417
499
|
}
|
|
418
500
|
set edgesColor(value) {
|
|
419
|
-
this.
|
|
420
|
-
this.change();
|
|
501
|
+
this.setProperty("edgesColor", value);
|
|
421
502
|
}
|
|
422
503
|
get facesColor() {
|
|
423
504
|
return this._data.facesColor;
|
|
424
505
|
}
|
|
425
506
|
set facesColor(value) {
|
|
426
|
-
this.
|
|
427
|
-
this.change();
|
|
507
|
+
this.setProperty("facesColor", value);
|
|
428
508
|
}
|
|
429
509
|
get edgesVisibility() {
|
|
430
510
|
return this._data.edgesVisibility;
|
|
431
511
|
}
|
|
432
512
|
set edgesVisibility(value) {
|
|
433
|
-
this.
|
|
434
|
-
this.change();
|
|
513
|
+
this.setProperty("edgesVisibility", value);
|
|
435
514
|
}
|
|
436
515
|
get edgesOverlap() {
|
|
437
516
|
return this._data.edgesOverlap;
|
|
438
517
|
}
|
|
439
518
|
set edgesOverlap(value) {
|
|
440
|
-
this.
|
|
441
|
-
this.change();
|
|
519
|
+
this.setProperty("edgesOverlap", value);
|
|
442
520
|
}
|
|
443
521
|
get facesOverlap() {
|
|
444
522
|
return this._data.facesOverlap;
|
|
445
523
|
}
|
|
446
524
|
set facesOverlap(value) {
|
|
447
|
-
this.
|
|
448
|
-
this.change();
|
|
525
|
+
this.setProperty("facesOverlap", value);
|
|
449
526
|
}
|
|
450
527
|
get facesTransparancy() {
|
|
451
528
|
return this._data.facesTransparancy;
|
|
452
529
|
}
|
|
453
530
|
set facesTransparancy(value) {
|
|
454
|
-
this.
|
|
455
|
-
this.change();
|
|
531
|
+
this.setProperty("facesTransparancy", value);
|
|
456
532
|
}
|
|
457
533
|
get enableCustomHighlight() {
|
|
458
534
|
return this._data.enableCustomHighlight;
|
|
459
535
|
}
|
|
460
536
|
set enableCustomHighlight(value) {
|
|
461
|
-
this.
|
|
462
|
-
this.change();
|
|
537
|
+
this.setProperty("enableCustomHighlight", value);
|
|
463
538
|
}
|
|
464
539
|
get sceneGraph() {
|
|
465
540
|
return this._data.sceneGraph;
|
|
466
541
|
}
|
|
467
542
|
set sceneGraph(value) {
|
|
468
|
-
this.
|
|
469
|
-
if (value)
|
|
470
|
-
this.
|
|
471
|
-
|
|
543
|
+
this.setProperty("sceneGraph", value);
|
|
544
|
+
if (value) {
|
|
545
|
+
this.setProperty("enablePartialMode", false);
|
|
546
|
+
}
|
|
472
547
|
}
|
|
473
548
|
get edgeModel() {
|
|
474
549
|
return Boolean(this._data.edgeModel);
|
|
475
550
|
}
|
|
476
551
|
set edgeModel(value) {
|
|
477
|
-
this.
|
|
478
|
-
this.change();
|
|
552
|
+
this.setProperty("edgeModel", value);
|
|
479
553
|
}
|
|
480
554
|
get reverseZoomWheel() {
|
|
481
555
|
return this._data.reverseZoomWheel;
|
|
482
556
|
}
|
|
483
557
|
set reverseZoomWheel(value) {
|
|
484
|
-
this.
|
|
485
|
-
this.change();
|
|
558
|
+
this.setProperty("reverseZoomWheel", value);
|
|
486
559
|
}
|
|
487
560
|
get enableZoomWheel() {
|
|
488
561
|
return this._data.enableZoomWheel;
|
|
489
562
|
}
|
|
490
563
|
set enableZoomWheel(value) {
|
|
491
|
-
this.
|
|
492
|
-
this.change();
|
|
564
|
+
this.setProperty("enableZoomWheel", value);
|
|
493
565
|
}
|
|
494
566
|
get enableGestures() {
|
|
495
567
|
return this._data.enableGestures;
|
|
496
568
|
}
|
|
497
569
|
set enableGestures(value) {
|
|
498
|
-
this.
|
|
499
|
-
this.change();
|
|
570
|
+
this.setProperty("enableGestures", value);
|
|
500
571
|
}
|
|
501
572
|
get geometryType() {
|
|
502
573
|
return this._data.geometryType;
|
|
503
574
|
}
|
|
504
575
|
set geometryType(value) {
|
|
505
|
-
this.
|
|
506
|
-
this.change();
|
|
576
|
+
this.setProperty("geometryType", value);
|
|
507
577
|
}
|
|
508
578
|
get rulerUnit() {
|
|
509
579
|
return this._data.rulerUnit;
|
|
510
580
|
}
|
|
511
581
|
set rulerUnit(value) {
|
|
512
|
-
this.
|
|
513
|
-
this.change();
|
|
582
|
+
this.setProperty("rulerUnit", value);
|
|
514
583
|
}
|
|
515
584
|
get rulerPrecision() {
|
|
516
585
|
return this._data.rulerPrecision;
|
|
517
586
|
}
|
|
518
587
|
set rulerPrecision(value) {
|
|
519
|
-
this.
|
|
520
|
-
this.change();
|
|
588
|
+
this.setProperty("rulerPrecision", value);
|
|
521
589
|
}
|
|
522
590
|
get cameraMode() {
|
|
523
591
|
return this._data.cameraMode || "perspective";
|
|
524
592
|
}
|
|
525
593
|
set cameraMode(value) {
|
|
526
|
-
this.
|
|
527
|
-
|
|
594
|
+
this.setProperty("cameraMode", value);
|
|
595
|
+
}
|
|
596
|
+
get snapshotMimeType() {
|
|
597
|
+
return this._data.snapshotMimeType;
|
|
598
|
+
}
|
|
599
|
+
set snapshotMimeType(value) {
|
|
600
|
+
this.setProperty("snapshotMimeType", value);
|
|
601
|
+
}
|
|
602
|
+
get snapshotQuality() {
|
|
603
|
+
return this._data.snapshotQuality;
|
|
604
|
+
}
|
|
605
|
+
set snapshotQuality(value) {
|
|
606
|
+
this.setProperty("snapshotQuality", value);
|
|
528
607
|
}
|
|
529
608
|
}
|
|
530
609
|
|