redhotmagma-visualization 1.43.2 → 1.44.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/DevApp.js +27 -0
- package/Three/Three2D.js +225 -202
- package/Three/Three3DScene.js +240 -199
- package/Utils/alignToElement.js +48 -23
- package/VisualizationInterface.js +39 -0
- package/package.json +2 -2
- package/src/DevApp.js +33 -0
- package/src/Three/Three2D.js +2 -1
- package/src/Three/Three3DScene.js +85 -72
- package/src/Utils/alignToElement.js +2 -1
- package/src/VisualizationInterface.js +15 -0
package/Three/Three2D.js
CHANGED
|
@@ -297,28 +297,51 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
297
297
|
}
|
|
298
298
|
}, {
|
|
299
299
|
key: "setCameraPositionToCurrentDesignArea",
|
|
300
|
-
value: function
|
|
301
|
-
var
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
300
|
+
value: function () {
|
|
301
|
+
var _setCameraPositionToCurrentDesignArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
302
|
+
var _ref5,
|
|
303
|
+
animate,
|
|
304
|
+
duration,
|
|
305
|
+
designArea,
|
|
306
|
+
obj,
|
|
307
|
+
zoom,
|
|
308
|
+
position,
|
|
309
|
+
_args2 = arguments;
|
|
310
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
311
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
312
|
+
case 0:
|
|
313
|
+
_ref5 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {
|
|
314
|
+
animate: false,
|
|
315
|
+
duration: {}
|
|
316
|
+
}, animate = _ref5.animate, duration = _ref5.duration;
|
|
317
|
+
_context2.next = 3;
|
|
318
|
+
return this.getScreenshotsReady();
|
|
319
|
+
case 3:
|
|
320
|
+
designArea = this._currentDesignArea || (0, _first["default"])(this._designAreaList);
|
|
321
|
+
obj = designArea && this.findAreaObjectByName(designArea.identifier);
|
|
322
|
+
zoom = this.calculateZoomForObject(obj);
|
|
323
|
+
position = new _three.Vector3();
|
|
324
|
+
if (obj) {
|
|
325
|
+
obj.getWorldPosition(position);
|
|
326
|
+
}
|
|
327
|
+
position.z = this.camera.position.z;
|
|
328
|
+
if (animate) {
|
|
329
|
+
this.moveCamera(position, zoom, duration);
|
|
330
|
+
} else {
|
|
331
|
+
this.stopAnimation("camera");
|
|
332
|
+
this.setCameraPosition(position, zoom);
|
|
333
|
+
}
|
|
334
|
+
case 10:
|
|
335
|
+
case "end":
|
|
336
|
+
return _context2.stop();
|
|
337
|
+
}
|
|
338
|
+
}, _callee2, this);
|
|
339
|
+
}));
|
|
340
|
+
function setCameraPositionToCurrentDesignArea() {
|
|
341
|
+
return _setCameraPositionToCurrentDesignArea.apply(this, arguments);
|
|
320
342
|
}
|
|
321
|
-
|
|
343
|
+
return setCameraPositionToCurrentDesignArea;
|
|
344
|
+
}()
|
|
322
345
|
}, {
|
|
323
346
|
key: "updateCamera",
|
|
324
347
|
value: function updateCamera(width, height) {
|
|
@@ -484,28 +507,28 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
484
507
|
}, {
|
|
485
508
|
key: "dispatchMaterialUpdateEvent",
|
|
486
509
|
value: function () {
|
|
487
|
-
var _dispatchMaterialUpdateEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
510
|
+
var _dispatchMaterialUpdateEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
488
511
|
var options,
|
|
489
512
|
_options$screenshot,
|
|
490
513
|
screenshot,
|
|
491
514
|
eventParams,
|
|
492
|
-
|
|
493
|
-
return _regeneratorRuntime().wrap(function
|
|
494
|
-
while (1) switch (
|
|
515
|
+
_args3 = arguments;
|
|
516
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
517
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
495
518
|
case 0:
|
|
496
|
-
options =
|
|
519
|
+
options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
497
520
|
_options$screenshot = options.screenshot, screenshot = _options$screenshot === void 0 ? false : _options$screenshot;
|
|
498
521
|
eventParams = {
|
|
499
522
|
variant: this._materialVariantPath,
|
|
500
523
|
screenshot: screenshot
|
|
501
524
|
}; // the redrawing of the areas can be synced if the event handler returns a Promise
|
|
502
|
-
|
|
525
|
+
_context3.next = 5;
|
|
503
526
|
return this.observable.dispatch(_Constants.EventTypes.MaterialUpdated, eventParams, true);
|
|
504
527
|
case 5:
|
|
505
528
|
case "end":
|
|
506
|
-
return
|
|
529
|
+
return _context3.stop();
|
|
507
530
|
}
|
|
508
|
-
},
|
|
531
|
+
}, _callee3, this);
|
|
509
532
|
}));
|
|
510
533
|
function dispatchMaterialUpdateEvent() {
|
|
511
534
|
return _dispatchMaterialUpdateEvent.apply(this, arguments);
|
|
@@ -515,22 +538,22 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
515
538
|
}, {
|
|
516
539
|
key: "updateMaterial",
|
|
517
540
|
value: function () {
|
|
518
|
-
var _updateMaterial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
541
|
+
var _updateMaterial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
519
542
|
var targetObject,
|
|
520
|
-
|
|
521
|
-
return _regeneratorRuntime().wrap(function
|
|
522
|
-
while (1) switch (
|
|
543
|
+
_args4 = arguments;
|
|
544
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
545
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
523
546
|
case 0:
|
|
524
|
-
targetObject =
|
|
525
|
-
|
|
547
|
+
targetObject = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : this.scene;
|
|
548
|
+
_context4.next = 3;
|
|
526
549
|
return this.updateView(this._currentDesignView);
|
|
527
550
|
case 3:
|
|
528
|
-
return
|
|
551
|
+
return _context4.abrupt("return", _context4.sent);
|
|
529
552
|
case 4:
|
|
530
553
|
case "end":
|
|
531
|
-
return
|
|
554
|
+
return _context4.stop();
|
|
532
555
|
}
|
|
533
|
-
},
|
|
556
|
+
}, _callee4, this);
|
|
534
557
|
}));
|
|
535
558
|
function updateMaterial() {
|
|
536
559
|
return _updateMaterial.apply(this, arguments);
|
|
@@ -540,30 +563,30 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
540
563
|
}, {
|
|
541
564
|
key: "_getDrawingContext",
|
|
542
565
|
value: function () {
|
|
543
|
-
var _getDrawingContext2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
566
|
+
var _getDrawingContext2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(drawingFn) {
|
|
544
567
|
var _this4 = this;
|
|
545
568
|
var updateAlpha,
|
|
546
569
|
clearTexture,
|
|
547
570
|
materialName,
|
|
548
571
|
availableDesignAreas,
|
|
549
|
-
|
|
550
|
-
return _regeneratorRuntime().wrap(function
|
|
551
|
-
while (1) switch (
|
|
572
|
+
_args6 = arguments;
|
|
573
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
574
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
552
575
|
case 0:
|
|
553
|
-
updateAlpha =
|
|
554
|
-
clearTexture =
|
|
555
|
-
materialName =
|
|
576
|
+
updateAlpha = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : false;
|
|
577
|
+
clearTexture = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : false;
|
|
578
|
+
materialName = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : undefined;
|
|
556
579
|
availableDesignAreas = (0, _get2["default"])(this._currentDesignView, "designAreas") || [];
|
|
557
|
-
|
|
580
|
+
_context6.next = 6;
|
|
558
581
|
return Promise.all(availableDesignAreas.map( /*#__PURE__*/function () {
|
|
559
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
582
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(designArea) {
|
|
560
583
|
var material, _this4$getCanvasConte, ctx, canvas, texture, getTextureBuilder, width, height;
|
|
561
|
-
return _regeneratorRuntime().wrap(function
|
|
562
|
-
while (1) switch (
|
|
584
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
585
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
563
586
|
case 0:
|
|
564
587
|
material = _this4._materialMap.get(designArea.identifier);
|
|
565
588
|
if (!(!material || !material.map || !material.map.image)) {
|
|
566
|
-
|
|
589
|
+
_context5.next = 3;
|
|
567
590
|
break;
|
|
568
591
|
}
|
|
569
592
|
throw new Error("Cannot get drawing context for material: ".concat(materialName, "! Is it prepared already?"));
|
|
@@ -577,15 +600,15 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
577
600
|
width = canvas.width, height = canvas.height;
|
|
578
601
|
ctx.clearRect(0, 0, width, height);
|
|
579
602
|
}
|
|
580
|
-
|
|
603
|
+
_context5.next = 8;
|
|
581
604
|
return drawingFn(ctx, getTextureBuilder, [designArea]);
|
|
582
605
|
case 8:
|
|
583
606
|
texture.needsUpdate = true;
|
|
584
607
|
case 9:
|
|
585
608
|
case "end":
|
|
586
|
-
return
|
|
609
|
+
return _context5.stop();
|
|
587
610
|
}
|
|
588
|
-
},
|
|
611
|
+
}, _callee5);
|
|
589
612
|
}));
|
|
590
613
|
return function (_x3) {
|
|
591
614
|
return _ref7.apply(this, arguments);
|
|
@@ -597,9 +620,9 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
597
620
|
}
|
|
598
621
|
case 7:
|
|
599
622
|
case "end":
|
|
600
|
-
return
|
|
623
|
+
return _context6.stop();
|
|
601
624
|
}
|
|
602
|
-
},
|
|
625
|
+
}, _callee6, this);
|
|
603
626
|
}));
|
|
604
627
|
function _getDrawingContext(_x2) {
|
|
605
628
|
return _getDrawingContext2.apply(this, arguments);
|
|
@@ -609,58 +632,58 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
609
632
|
}, {
|
|
610
633
|
key: "getDrawingContext",
|
|
611
634
|
value: function () {
|
|
612
|
-
var _getDrawingContext3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
635
|
+
var _getDrawingContext3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
613
636
|
var _this$_getDrawingCont,
|
|
614
637
|
_this5 = this;
|
|
615
|
-
var
|
|
616
|
-
return _regeneratorRuntime().wrap(function
|
|
617
|
-
while (1) switch (
|
|
638
|
+
var _args8 = arguments;
|
|
639
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
640
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
618
641
|
case 0:
|
|
619
|
-
this._redraw = (_this$_getDrawingCont = this._getDrawingContext).bind.apply(_this$_getDrawingCont, [this].concat(Array.prototype.slice.call(
|
|
620
|
-
|
|
621
|
-
|
|
642
|
+
this._redraw = (_this$_getDrawingCont = this._getDrawingContext).bind.apply(_this$_getDrawingCont, [this].concat(Array.prototype.slice.call(_args8)));
|
|
643
|
+
_context8.prev = 1;
|
|
644
|
+
_context8.next = 4;
|
|
622
645
|
return this._redrawPromise;
|
|
623
646
|
case 4:
|
|
624
|
-
|
|
647
|
+
_context8.next = 8;
|
|
625
648
|
break;
|
|
626
649
|
case 6:
|
|
627
|
-
|
|
628
|
-
|
|
650
|
+
_context8.prev = 6;
|
|
651
|
+
_context8.t0 = _context8["catch"](1);
|
|
629
652
|
case 8:
|
|
630
653
|
this._redrawPromise = new Promise(function (resolve, reject) {
|
|
631
|
-
_this5._redrawFrame = window.requestAnimationFrame( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
632
|
-
return _regeneratorRuntime().wrap(function
|
|
633
|
-
while (1) switch (
|
|
654
|
+
_this5._redrawFrame = window.requestAnimationFrame( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
655
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
656
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
634
657
|
case 0:
|
|
635
|
-
|
|
636
|
-
|
|
658
|
+
_context7.prev = 0;
|
|
659
|
+
_context7.next = 3;
|
|
637
660
|
return _this5.redraw();
|
|
638
661
|
case 3:
|
|
639
662
|
resolve();
|
|
640
|
-
|
|
663
|
+
_context7.next = 9;
|
|
641
664
|
break;
|
|
642
665
|
case 6:
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
reject(
|
|
666
|
+
_context7.prev = 6;
|
|
667
|
+
_context7.t0 = _context7["catch"](0);
|
|
668
|
+
reject(_context7.t0);
|
|
646
669
|
case 9:
|
|
647
|
-
|
|
670
|
+
_context7.prev = 9;
|
|
648
671
|
delete _this5._redrawPromise;
|
|
649
|
-
return
|
|
672
|
+
return _context7.finish(9);
|
|
650
673
|
case 12:
|
|
651
674
|
case "end":
|
|
652
|
-
return
|
|
675
|
+
return _context7.stop();
|
|
653
676
|
}
|
|
654
|
-
},
|
|
677
|
+
}, _callee7, null, [[0, 6, 9, 12]]);
|
|
655
678
|
})));
|
|
656
679
|
});
|
|
657
|
-
|
|
680
|
+
_context8.next = 11;
|
|
658
681
|
return this._redrawPromise;
|
|
659
682
|
case 11:
|
|
660
683
|
case "end":
|
|
661
|
-
return
|
|
684
|
+
return _context8.stop();
|
|
662
685
|
}
|
|
663
|
-
},
|
|
686
|
+
}, _callee8, this, [[1, 6]]);
|
|
664
687
|
}));
|
|
665
688
|
function getDrawingContext() {
|
|
666
689
|
return _getDrawingContext3.apply(this, arguments);
|
|
@@ -713,28 +736,28 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
713
736
|
}, {
|
|
714
737
|
key: "loadView",
|
|
715
738
|
value: function () {
|
|
716
|
-
var _loadView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
739
|
+
var _loadView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
717
740
|
var rerender,
|
|
718
741
|
url,
|
|
719
742
|
image,
|
|
720
743
|
tex,
|
|
721
|
-
|
|
722
|
-
return _regeneratorRuntime().wrap(function
|
|
723
|
-
while (1) switch (
|
|
744
|
+
_args9 = arguments;
|
|
745
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
746
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
724
747
|
case 0:
|
|
725
|
-
rerender =
|
|
748
|
+
rerender = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
726
749
|
if (this._itemPath && this._viewPath) {
|
|
727
|
-
|
|
750
|
+
_context9.next = 3;
|
|
728
751
|
break;
|
|
729
752
|
}
|
|
730
|
-
return
|
|
753
|
+
return _context9.abrupt("return", false);
|
|
731
754
|
case 3:
|
|
732
755
|
url = this.getModelPath();
|
|
733
756
|
this.onLoadStart();
|
|
734
|
-
|
|
757
|
+
_context9.next = 7;
|
|
735
758
|
return this._imageRepository.loadImage(url);
|
|
736
759
|
case 7:
|
|
737
|
-
image =
|
|
760
|
+
image = _context9.sent;
|
|
738
761
|
this.onLoadFinished();
|
|
739
762
|
tex = new _three.Texture(this._options.optimizeProductImage ? (0, _optimizeTextureImage.optimizeTextureImage)(image, MAX_TEXTURE_SIZE, MIN_TEXTURE_SIZE) : image);
|
|
740
763
|
tex.premultiplyAlpha = this._options.premultiplyAlpha;
|
|
@@ -749,9 +772,9 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
749
772
|
}
|
|
750
773
|
case 16:
|
|
751
774
|
case "end":
|
|
752
|
-
return
|
|
775
|
+
return _context9.stop();
|
|
753
776
|
}
|
|
754
|
-
},
|
|
777
|
+
}, _callee9, this);
|
|
755
778
|
}));
|
|
756
779
|
function loadView() {
|
|
757
780
|
return _loadView.apply(this, arguments);
|
|
@@ -948,24 +971,24 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
948
971
|
}, {
|
|
949
972
|
key: "updateViewForArea",
|
|
950
973
|
value: function () {
|
|
951
|
-
var _updateViewForArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
974
|
+
var _updateViewForArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(selectedDesignArea) {
|
|
952
975
|
var options,
|
|
953
976
|
designView,
|
|
954
|
-
|
|
955
|
-
return _regeneratorRuntime().wrap(function
|
|
956
|
-
while (1) switch (
|
|
977
|
+
_args10 = arguments;
|
|
978
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
979
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
957
980
|
case 0:
|
|
958
|
-
options =
|
|
981
|
+
options = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
|
|
959
982
|
designView = (0, _get2["default"])(selectedDesignArea, "designView");
|
|
960
|
-
|
|
983
|
+
_context10.next = 4;
|
|
961
984
|
return this.updateView(designView, options);
|
|
962
985
|
case 4:
|
|
963
|
-
return
|
|
986
|
+
return _context10.abrupt("return", _context10.sent);
|
|
964
987
|
case 5:
|
|
965
988
|
case "end":
|
|
966
|
-
return
|
|
989
|
+
return _context10.stop();
|
|
967
990
|
}
|
|
968
|
-
},
|
|
991
|
+
}, _callee10, this);
|
|
969
992
|
}));
|
|
970
993
|
function updateViewForArea(_x4) {
|
|
971
994
|
return _updateViewForArea.apply(this, arguments);
|
|
@@ -1008,7 +1031,7 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1008
1031
|
}, {
|
|
1009
1032
|
key: "jumpToArea",
|
|
1010
1033
|
value: function () {
|
|
1011
|
-
var _jumpToArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1034
|
+
var _jumpToArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(designAreaIdentifier) {
|
|
1012
1035
|
var animate,
|
|
1013
1036
|
duration,
|
|
1014
1037
|
forceUpdate,
|
|
@@ -1016,20 +1039,20 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1016
1039
|
obj,
|
|
1017
1040
|
zoom,
|
|
1018
1041
|
position,
|
|
1019
|
-
|
|
1020
|
-
return _regeneratorRuntime().wrap(function
|
|
1021
|
-
while (1) switch (
|
|
1042
|
+
_args11 = arguments;
|
|
1043
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1044
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1022
1045
|
case 0:
|
|
1023
|
-
animate =
|
|
1024
|
-
duration =
|
|
1025
|
-
forceUpdate =
|
|
1046
|
+
animate = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : true;
|
|
1047
|
+
duration = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
1048
|
+
forceUpdate = _args11.length > 3 && _args11[3] !== undefined ? _args11[3] : false;
|
|
1026
1049
|
// use the current design area if present, otherwise try to find it by the designViewIdentifier
|
|
1027
1050
|
designArea = (0, _size["default"])(this._currentDesignArea) > 0 ? this._currentDesignArea : this.findDesignArea(designAreaIdentifier);
|
|
1028
1051
|
if (!(designAreaIdentifier !== "default")) {
|
|
1029
|
-
|
|
1052
|
+
_context11.next = 8;
|
|
1030
1053
|
break;
|
|
1031
1054
|
}
|
|
1032
|
-
|
|
1055
|
+
_context11.next = 7;
|
|
1033
1056
|
return this.updateViewForArea(designArea, {
|
|
1034
1057
|
forceUpdate: forceUpdate
|
|
1035
1058
|
});
|
|
@@ -1037,12 +1060,12 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1037
1060
|
this.render();
|
|
1038
1061
|
case 8:
|
|
1039
1062
|
if (this._containerGroup) {
|
|
1040
|
-
|
|
1063
|
+
_context11.next = 11;
|
|
1041
1064
|
break;
|
|
1042
1065
|
}
|
|
1043
1066
|
// eslint-disable-next-line no-console
|
|
1044
1067
|
console.log("Container group is not available, skipping jump to view!");
|
|
1045
|
-
return
|
|
1068
|
+
return _context11.abrupt("return", false);
|
|
1046
1069
|
case 11:
|
|
1047
1070
|
obj = designArea && this.findAreaObjectByName(designArea.identifier);
|
|
1048
1071
|
zoom = this.calculateZoomForObject(obj);
|
|
@@ -1056,12 +1079,12 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1056
1079
|
} else {
|
|
1057
1080
|
this.setCameraPosition(position, zoom);
|
|
1058
1081
|
}
|
|
1059
|
-
return
|
|
1082
|
+
return _context11.abrupt("return", true);
|
|
1060
1083
|
case 18:
|
|
1061
1084
|
case "end":
|
|
1062
|
-
return
|
|
1085
|
+
return _context11.stop();
|
|
1063
1086
|
}
|
|
1064
|
-
},
|
|
1087
|
+
}, _callee11, this);
|
|
1065
1088
|
}));
|
|
1066
1089
|
function jumpToArea(_x5) {
|
|
1067
1090
|
return _jumpToArea.apply(this, arguments);
|
|
@@ -1076,28 +1099,28 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1076
1099
|
}, {
|
|
1077
1100
|
key: "setView",
|
|
1078
1101
|
value: function () {
|
|
1079
|
-
var _setView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1080
|
-
return _regeneratorRuntime().wrap(function
|
|
1081
|
-
while (1) switch (
|
|
1102
|
+
var _setView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(designView) {
|
|
1103
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1104
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1082
1105
|
case 0:
|
|
1083
|
-
|
|
1106
|
+
_context12.next = 2;
|
|
1084
1107
|
return this.updateView(designView);
|
|
1085
1108
|
case 2:
|
|
1086
1109
|
if (this._containerGroup) {
|
|
1087
|
-
|
|
1110
|
+
_context12.next = 5;
|
|
1088
1111
|
break;
|
|
1089
1112
|
}
|
|
1090
1113
|
// eslint-disable-next-line no-console
|
|
1091
1114
|
console.log("Container group is not available, skipping jump to view!");
|
|
1092
|
-
return
|
|
1115
|
+
return _context12.abrupt("return", false);
|
|
1093
1116
|
case 5:
|
|
1094
1117
|
this.render();
|
|
1095
|
-
return
|
|
1118
|
+
return _context12.abrupt("return", true);
|
|
1096
1119
|
case 7:
|
|
1097
1120
|
case "end":
|
|
1098
|
-
return
|
|
1121
|
+
return _context12.stop();
|
|
1099
1122
|
}
|
|
1100
|
-
},
|
|
1123
|
+
}, _callee12, this);
|
|
1101
1124
|
}));
|
|
1102
1125
|
function setView(_x6) {
|
|
1103
1126
|
return _setView.apply(this, arguments);
|
|
@@ -1121,18 +1144,18 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1121
1144
|
}, {
|
|
1122
1145
|
key: "updateDesignAreaList",
|
|
1123
1146
|
value: function () {
|
|
1124
|
-
var _updateDesignAreaList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1147
|
+
var _updateDesignAreaList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(designAreaList) {
|
|
1125
1148
|
var updateView,
|
|
1126
1149
|
identifier,
|
|
1127
1150
|
activeArea,
|
|
1128
|
-
|
|
1129
|
-
return _regeneratorRuntime().wrap(function
|
|
1130
|
-
while (1) switch (
|
|
1151
|
+
_args13 = arguments;
|
|
1152
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1153
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1131
1154
|
case 0:
|
|
1132
|
-
updateView =
|
|
1155
|
+
updateView = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : false;
|
|
1133
1156
|
this._designAreaList = designAreaList;
|
|
1134
1157
|
if (!updateView) {
|
|
1135
|
-
|
|
1158
|
+
_context13.next = 9;
|
|
1136
1159
|
break;
|
|
1137
1160
|
}
|
|
1138
1161
|
identifier = this._currentDesignArea && this._currentDesignArea.identifier;
|
|
@@ -1140,19 +1163,19 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1140
1163
|
identifier: identifier
|
|
1141
1164
|
}) || (0, _first["default"])(designAreaList);
|
|
1142
1165
|
if (!activeArea) {
|
|
1143
|
-
|
|
1166
|
+
_context13.next = 9;
|
|
1144
1167
|
break;
|
|
1145
1168
|
}
|
|
1146
|
-
|
|
1169
|
+
_context13.next = 8;
|
|
1147
1170
|
return this.updateViewForArea(activeArea);
|
|
1148
1171
|
case 8:
|
|
1149
1172
|
// update the zoom to the initial value only if there is no designArea selected
|
|
1150
1173
|
!identifier && this.updateZoom();
|
|
1151
1174
|
case 9:
|
|
1152
1175
|
case "end":
|
|
1153
|
-
return
|
|
1176
|
+
return _context13.stop();
|
|
1154
1177
|
}
|
|
1155
|
-
},
|
|
1178
|
+
}, _callee13, this);
|
|
1156
1179
|
}));
|
|
1157
1180
|
function updateDesignAreaList(_x7) {
|
|
1158
1181
|
return _updateDesignAreaList.apply(this, arguments);
|
|
@@ -1179,28 +1202,28 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1179
1202
|
}, {
|
|
1180
1203
|
key: "getScreenshots",
|
|
1181
1204
|
value: function () {
|
|
1182
|
-
var _getScreenshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1205
|
+
var _getScreenshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(callback, _ref10) {
|
|
1183
1206
|
var _this9 = this;
|
|
1184
1207
|
var designViewList, areaList, variantList, size, removeTempOverlay, origDesignView, designAreaList, variants, screenshots, origVariantPath, origSize, origPixelRatio, restoreOriginalValues, camera, views, _iterator, _step, _loop, _ret;
|
|
1185
|
-
return _regeneratorRuntime().wrap(function
|
|
1186
|
-
while (1) switch (
|
|
1208
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context18) {
|
|
1209
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1187
1210
|
case 0:
|
|
1188
1211
|
designViewList = _ref10.designViewList, areaList = _ref10.areaList, variantList = _ref10.variantList, size = _ref10.size;
|
|
1189
1212
|
if (this.renderer) {
|
|
1190
|
-
|
|
1213
|
+
_context18.next = 3;
|
|
1191
1214
|
break;
|
|
1192
1215
|
}
|
|
1193
|
-
return
|
|
1216
|
+
return _context18.abrupt("return", callback({}));
|
|
1194
1217
|
case 3:
|
|
1195
1218
|
this._screenshottingInProgress = true;
|
|
1196
1219
|
this.endAnimation();
|
|
1197
|
-
|
|
1220
|
+
_context18.next = 7;
|
|
1198
1221
|
return this.animationRunning();
|
|
1199
1222
|
case 7:
|
|
1200
|
-
|
|
1223
|
+
_context18.next = 9;
|
|
1201
1224
|
return this.createTempOverlay();
|
|
1202
1225
|
case 9:
|
|
1203
|
-
removeTempOverlay =
|
|
1226
|
+
removeTempOverlay = _context18.sent;
|
|
1204
1227
|
origDesignView = this._currentDesignView; // if the areaList option is provided, use it to filter the design areas
|
|
1205
1228
|
designAreaList = areaList instanceof Array && areaList.length > 0 ? this._designAreaList.filter(function (designArea) {
|
|
1206
1229
|
return areaList.indexOf(designArea.identifier) !== -1;
|
|
@@ -1212,15 +1235,15 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1212
1235
|
this.renderer.getSize(origSize);
|
|
1213
1236
|
origPixelRatio = this.renderer.getPixelRatio();
|
|
1214
1237
|
restoreOriginalValues = /*#__PURE__*/function () {
|
|
1215
|
-
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1216
|
-
return _regeneratorRuntime().wrap(function
|
|
1217
|
-
while (1) switch (
|
|
1238
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1239
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1240
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1218
1241
|
case 0:
|
|
1219
1242
|
_this9._screenshotCamera = null;
|
|
1220
1243
|
_this9._screenshottingInProgress = false;
|
|
1221
1244
|
_this9._materialVariantPath = origVariantPath;
|
|
1222
1245
|
_this9._currentDesignView = null;
|
|
1223
|
-
|
|
1246
|
+
_context14.next = 6;
|
|
1224
1247
|
return _this9.setView(origDesignView);
|
|
1225
1248
|
case 6:
|
|
1226
1249
|
_this9.renderer.setSize(origSize.width, origSize.height);
|
|
@@ -1229,9 +1252,9 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1229
1252
|
removeTempOverlay();
|
|
1230
1253
|
case 10:
|
|
1231
1254
|
case "end":
|
|
1232
|
-
return
|
|
1255
|
+
return _context14.stop();
|
|
1233
1256
|
}
|
|
1234
|
-
},
|
|
1257
|
+
}, _callee14);
|
|
1235
1258
|
}));
|
|
1236
1259
|
return function restoreOriginalValues() {
|
|
1237
1260
|
return _ref11.apply(this, arguments);
|
|
@@ -1244,48 +1267,48 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1244
1267
|
return designView;
|
|
1245
1268
|
});
|
|
1246
1269
|
_iterator = _createForOfIteratorHelper(variants);
|
|
1247
|
-
|
|
1270
|
+
_context18.prev = 23;
|
|
1248
1271
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
1249
1272
|
var variant, data, _iterator2, _step2, _loop2, _ret2;
|
|
1250
|
-
return _regeneratorRuntime().wrap(function _loop$(
|
|
1251
|
-
while (1) switch (
|
|
1273
|
+
return _regeneratorRuntime().wrap(function _loop$(_context17) {
|
|
1274
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1252
1275
|
case 0:
|
|
1253
1276
|
variant = _step.value;
|
|
1254
1277
|
data = {};
|
|
1255
1278
|
_this9.setMaterialVariantPath(variant);
|
|
1256
1279
|
_this9._currentDesignView = null;
|
|
1257
1280
|
_iterator2 = _createForOfIteratorHelper(views);
|
|
1258
|
-
|
|
1281
|
+
_context17.prev = 5;
|
|
1259
1282
|
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
|
|
1260
1283
|
var view;
|
|
1261
|
-
return _regeneratorRuntime().wrap(function _loop2$(
|
|
1262
|
-
while (1) switch (
|
|
1284
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context16) {
|
|
1285
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1263
1286
|
case 0:
|
|
1264
1287
|
view = _step2.value;
|
|
1265
1288
|
if (!_this9._abortScreenshotting) {
|
|
1266
|
-
|
|
1289
|
+
_context16.next = 7;
|
|
1267
1290
|
break;
|
|
1268
1291
|
}
|
|
1269
|
-
|
|
1292
|
+
_context16.next = 4;
|
|
1270
1293
|
return restoreOriginalValues();
|
|
1271
1294
|
case 4:
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
v:
|
|
1295
|
+
_context16.t0 = _context16.sent;
|
|
1296
|
+
_context16.t1 = {
|
|
1297
|
+
v: _context16.t0
|
|
1275
1298
|
};
|
|
1276
|
-
return
|
|
1277
|
-
v:
|
|
1299
|
+
return _context16.abrupt("return", {
|
|
1300
|
+
v: _context16.t1
|
|
1278
1301
|
});
|
|
1279
1302
|
case 7:
|
|
1280
|
-
|
|
1281
|
-
|
|
1303
|
+
_context16.prev = 7;
|
|
1304
|
+
_context16.next = 10;
|
|
1282
1305
|
return new Promise(function (resolve) {
|
|
1283
|
-
window.setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1306
|
+
window.setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1284
1307
|
var _this9$getScreenshotS, width, height;
|
|
1285
|
-
return _regeneratorRuntime().wrap(function
|
|
1286
|
-
while (1) switch (
|
|
1308
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1309
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1287
1310
|
case 0:
|
|
1288
|
-
|
|
1311
|
+
_context15.next = 2;
|
|
1289
1312
|
return _this9.updateView(view, {
|
|
1290
1313
|
forceUpdate: false,
|
|
1291
1314
|
updateMaterial: false
|
|
@@ -1300,7 +1323,7 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1300
1323
|
height: height
|
|
1301
1324
|
});
|
|
1302
1325
|
camera.updateProjectionMatrix();
|
|
1303
|
-
|
|
1326
|
+
_context15.next = 10;
|
|
1304
1327
|
return _this9.dispatchMaterialUpdateEvent({
|
|
1305
1328
|
screenshot: true
|
|
1306
1329
|
});
|
|
@@ -1313,97 +1336,97 @@ var Three2D = exports.Three2D = /*#__PURE__*/function (_ThreeBase) {
|
|
|
1313
1336
|
resolve();
|
|
1314
1337
|
case 15:
|
|
1315
1338
|
case "end":
|
|
1316
|
-
return
|
|
1339
|
+
return _context15.stop();
|
|
1317
1340
|
}
|
|
1318
|
-
},
|
|
1341
|
+
}, _callee15);
|
|
1319
1342
|
})));
|
|
1320
1343
|
});
|
|
1321
1344
|
case 10:
|
|
1322
|
-
|
|
1345
|
+
_context16.next = 14;
|
|
1323
1346
|
break;
|
|
1324
1347
|
case 12:
|
|
1325
|
-
|
|
1326
|
-
|
|
1348
|
+
_context16.prev = 12;
|
|
1349
|
+
_context16.t2 = _context16["catch"](7);
|
|
1327
1350
|
case 14:
|
|
1328
1351
|
case "end":
|
|
1329
|
-
return
|
|
1352
|
+
return _context16.stop();
|
|
1330
1353
|
}
|
|
1331
1354
|
}, _loop2, null, [[7, 12]]);
|
|
1332
1355
|
});
|
|
1333
1356
|
_iterator2.s();
|
|
1334
1357
|
case 8:
|
|
1335
1358
|
if ((_step2 = _iterator2.n()).done) {
|
|
1336
|
-
|
|
1359
|
+
_context17.next = 15;
|
|
1337
1360
|
break;
|
|
1338
1361
|
}
|
|
1339
|
-
return
|
|
1362
|
+
return _context17.delegateYield(_loop2(), "t0", 10);
|
|
1340
1363
|
case 10:
|
|
1341
|
-
_ret2 =
|
|
1364
|
+
_ret2 = _context17.t0;
|
|
1342
1365
|
if (!_ret2) {
|
|
1343
|
-
|
|
1366
|
+
_context17.next = 13;
|
|
1344
1367
|
break;
|
|
1345
1368
|
}
|
|
1346
|
-
return
|
|
1369
|
+
return _context17.abrupt("return", _ret2.v);
|
|
1347
1370
|
case 13:
|
|
1348
|
-
|
|
1371
|
+
_context17.next = 8;
|
|
1349
1372
|
break;
|
|
1350
1373
|
case 15:
|
|
1351
|
-
|
|
1374
|
+
_context17.next = 20;
|
|
1352
1375
|
break;
|
|
1353
1376
|
case 17:
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
_iterator2.e(
|
|
1377
|
+
_context17.prev = 17;
|
|
1378
|
+
_context17.t1 = _context17["catch"](5);
|
|
1379
|
+
_iterator2.e(_context17.t1);
|
|
1357
1380
|
case 20:
|
|
1358
|
-
|
|
1381
|
+
_context17.prev = 20;
|
|
1359
1382
|
_iterator2.f();
|
|
1360
|
-
return
|
|
1383
|
+
return _context17.finish(20);
|
|
1361
1384
|
case 23:
|
|
1362
1385
|
screenshots[variant] = data;
|
|
1363
1386
|
case 24:
|
|
1364
1387
|
case "end":
|
|
1365
|
-
return
|
|
1388
|
+
return _context17.stop();
|
|
1366
1389
|
}
|
|
1367
1390
|
}, _loop, null, [[5, 17, 20, 23]]);
|
|
1368
1391
|
});
|
|
1369
1392
|
_iterator.s();
|
|
1370
1393
|
case 26:
|
|
1371
1394
|
if ((_step = _iterator.n()).done) {
|
|
1372
|
-
|
|
1395
|
+
_context18.next = 33;
|
|
1373
1396
|
break;
|
|
1374
1397
|
}
|
|
1375
|
-
return
|
|
1398
|
+
return _context18.delegateYield(_loop(), "t0", 28);
|
|
1376
1399
|
case 28:
|
|
1377
|
-
_ret =
|
|
1400
|
+
_ret = _context18.t0;
|
|
1378
1401
|
if (!_ret) {
|
|
1379
|
-
|
|
1402
|
+
_context18.next = 31;
|
|
1380
1403
|
break;
|
|
1381
1404
|
}
|
|
1382
|
-
return
|
|
1405
|
+
return _context18.abrupt("return", _ret.v);
|
|
1383
1406
|
case 31:
|
|
1384
|
-
|
|
1407
|
+
_context18.next = 26;
|
|
1385
1408
|
break;
|
|
1386
1409
|
case 33:
|
|
1387
|
-
|
|
1410
|
+
_context18.next = 38;
|
|
1388
1411
|
break;
|
|
1389
1412
|
case 35:
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
_iterator.e(
|
|
1413
|
+
_context18.prev = 35;
|
|
1414
|
+
_context18.t1 = _context18["catch"](23);
|
|
1415
|
+
_iterator.e(_context18.t1);
|
|
1393
1416
|
case 38:
|
|
1394
|
-
|
|
1417
|
+
_context18.prev = 38;
|
|
1395
1418
|
_iterator.f();
|
|
1396
|
-
return
|
|
1419
|
+
return _context18.finish(38);
|
|
1397
1420
|
case 41:
|
|
1398
|
-
|
|
1421
|
+
_context18.next = 43;
|
|
1399
1422
|
return restoreOriginalValues();
|
|
1400
1423
|
case 43:
|
|
1401
1424
|
callback(screenshots);
|
|
1402
1425
|
case 44:
|
|
1403
1426
|
case "end":
|
|
1404
|
-
return
|
|
1427
|
+
return _context18.stop();
|
|
1405
1428
|
}
|
|
1406
|
-
},
|
|
1429
|
+
}, _callee16, this, [[23, 35, 38, 41]]);
|
|
1407
1430
|
}));
|
|
1408
1431
|
function getScreenshots(_x8, _x9) {
|
|
1409
1432
|
return _getScreenshots.apply(this, arguments);
|