redhotmagma-visualization 1.41.0 → 1.42.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/AlignTargetProvider.js +50 -79
- package/CommonUtils/Deferred.js +11 -38
- package/CommonUtils/Observable.js +29 -48
- package/CommonUtils/PropertyObserver.js +10 -17
- package/CommonUtils/SyncCurrentFunction.js +33 -42
- package/CommonUtils/SyncObservableEvent.js +2 -6
- package/CommonUtils/pointerEvent.js +50 -98
- package/Constants.js +6 -6
- package/DevApp.js +187 -309
- package/ExposedModules.js +2 -9
- package/FallbackVisualization.js +4 -10
- package/PrintingEffects/ColorEmbossingEffect.js +15 -26
- package/PrintingEffects/DomingEffect.js +29 -52
- package/PrintingEffects/EmbossingEffect.js +17 -29
- package/PrintingEffects/EmbroideryEffect.js +251 -362
- package/PrintingEffects/EngravingEffect.js +17 -29
- package/PrintingEffects/PrintingEffects.js +44 -73
- package/PrintingEffects/PrintingEffectsUtils.js +1 -7
- package/React/ReactBase.js +15 -47
- package/Three/Controls/OrbitControls.js +105 -126
- package/Three/Exporters/glTFExporter.js +2 -6
- package/Three/Loaders/ColladaLoader.js +202 -550
- package/Three/Loaders/MTLLoader.js +33 -64
- package/Three/Loaders/OBJLoader.js +48 -80
- package/Three/Three2D.js +750 -1014
- package/Three/Three2DLayers.js +217 -341
- package/Three/Three3D.js +530 -800
- package/Three/Three3DScene.js +484 -780
- package/Three/ThreeBase.js +145 -230
- package/Utils/DesignArea/getDesignAreaCanvasSize.js +3 -11
- package/Utils/TextureBuilder/createTextureBuilder.js +133 -193
- package/Utils/TextureBuilder/textureBuilderFunctions.js +11 -27
- package/Utils/alignToElement.js +13 -24
- package/Utils/canvasBlur.js +27 -45
- package/Utils/createAlphaMapFromAlphaChannel.js +11 -21
- package/Utils/createBakedShadow.js +38 -42
- package/Utils/createCache.js +0 -4
- package/Utils/createCanvas.js +3 -9
- package/Utils/createImageRepository.js +63 -87
- package/Utils/disposeMaterial.js +4 -14
- package/Utils/getImageSize.js +1 -2
- package/Utils/imagePreloader.js +36 -48
- package/Utils/initTextureCanvas.js +6 -18
- package/Utils/isMobileDevice.js +3 -7
- package/Utils/optimizeTextureImage.js +13 -29
- package/Utils/rememberCameraViewOffset.js +8 -11
- package/Utils/removeObject.js +0 -4
- package/Utils/restrictCameraMovement.js +2 -12
- package/Utils/setLightShadow.js +3 -5
- package/Utils/setOrthographicCameraSize.js +0 -1
- package/Utils/updateFitSizeToElement.js +4 -9
- package/VisualizationContainer.js +37 -90
- package/VisualizationInterface.js +32 -67
- package/VisualizationProvider.js +5 -15
- package/index.js +2 -9
- package/package.json +6 -7
- package/scripts/cpPublicLocal.js +7 -2
- package/src/CommonUtils/Observable.js +1 -0
- package/src/CommonUtils/pointerEvent.js +17 -0
- package/src/Constants.js +2 -0
- package/src/DevApp.js +1 -2
- package/src/Three/Three2D.js +105 -1
- package/src/Three/ThreeBase.js +31 -3
- package/src/Utils/TextureBuilder/createTextureBuilder.js +12 -3
- package/src/VisualizationContainer.js +8 -2
- package/src/index.js +2 -3
- package/visualizationAdapterCreator.js +6 -23
package/Three/Three2DLayers.js
CHANGED
|
@@ -1,194 +1,131 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.Three2DLayers = void 0;
|
|
9
|
-
|
|
10
7
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
11
|
-
|
|
12
8
|
var _first = _interopRequireDefault(require("lodash/first"));
|
|
13
|
-
|
|
14
9
|
var _three = require("three");
|
|
15
|
-
|
|
16
10
|
var _createCanvas = require("../Utils/createCanvas");
|
|
17
|
-
|
|
18
11
|
var _getImageSize = require("../Utils/getImageSize");
|
|
19
|
-
|
|
20
12
|
var _createCache = require("../Utils/createCache");
|
|
21
|
-
|
|
22
13
|
var _createImageRepository = require("../Utils/createImageRepository");
|
|
23
|
-
|
|
24
14
|
var _setOrthographicCameraSize = require("../Utils/setOrthographicCameraSize");
|
|
25
|
-
|
|
26
15
|
var _optimizeTextureImage = require("../Utils/optimizeTextureImage");
|
|
27
|
-
|
|
28
16
|
var _SyncObservableEvent = require("../CommonUtils/SyncObservableEvent");
|
|
29
|
-
|
|
30
17
|
var _Three2D2 = require("./Three2D");
|
|
31
|
-
|
|
32
18
|
var _Constants = require("../Constants");
|
|
33
|
-
|
|
34
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
-
|
|
36
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(
|
|
37
|
-
|
|
20
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
21
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
38
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
-
|
|
40
23
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
-
|
|
42
24
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
-
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
48
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
-
|
|
28
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
50
29
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
51
|
-
|
|
52
30
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
57
|
-
|
|
31
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
32
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
58
33
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
63
|
-
|
|
64
|
-
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
|
65
|
-
|
|
34
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
35
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
36
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
66
37
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
67
|
-
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
71
|
-
|
|
38
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
39
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
72
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
73
|
-
|
|
74
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
75
|
-
|
|
41
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
76
42
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
77
|
-
|
|
78
43
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
79
|
-
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
var Three2DLayers = /*#__PURE__*/function (_Three2D) {
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
46
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
47
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
48
|
+
var Three2DLayers = exports.Three2DLayers = /*#__PURE__*/function (_Three2D) {
|
|
85
49
|
_inherits(Three2DLayers, _Three2D);
|
|
86
|
-
|
|
87
50
|
var _super = _createSuper(Three2DLayers);
|
|
88
|
-
|
|
89
51
|
function Three2DLayers() {
|
|
90
52
|
var _this;
|
|
91
|
-
|
|
92
53
|
_classCallCheck(this, Three2DLayers);
|
|
93
|
-
|
|
94
54
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
95
55
|
args[_key] = arguments[_key];
|
|
96
56
|
}
|
|
97
|
-
|
|
98
57
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
99
|
-
|
|
100
58
|
_defineProperty(_assertThisInitialized(_this), "_configuration", null);
|
|
101
|
-
|
|
102
59
|
_defineProperty(_assertThisInitialized(_this), "_viewImages", {});
|
|
103
|
-
|
|
104
60
|
_defineProperty(_assertThisInitialized(_this), "_imageRepository", (0, _createImageRepository.createImageRepository)((0, _createCache.createCache)(20), function (src) {
|
|
105
61
|
return new Promise(function (resolve, reject) {
|
|
106
62
|
return new _three.ImageLoader(_this._loadingManager).load(src, resolve, undefined, reject);
|
|
107
63
|
});
|
|
108
64
|
}));
|
|
109
|
-
|
|
110
65
|
_defineProperty(_assertThisInitialized(_this), "_modelPathList", []);
|
|
111
|
-
|
|
112
66
|
_defineProperty(_assertThisInitialized(_this), "_initSync", (0, _SyncObservableEvent.syncObservableEvent)(_this.observable, _Constants.EventTypes.Initialized));
|
|
113
|
-
|
|
114
67
|
return _this;
|
|
115
68
|
}
|
|
116
|
-
|
|
117
69
|
_createClass(Three2DLayers, [{
|
|
118
70
|
key: "getCurrentDesignView",
|
|
119
71
|
value: function getCurrentDesignView() {
|
|
120
72
|
var _this2 = this;
|
|
121
|
-
|
|
122
73
|
var designViewIdentifiers = Object.keys(this._viewImages);
|
|
123
|
-
|
|
124
74
|
if (!this._currentDesignView) {
|
|
125
75
|
this._currentDesignView = {
|
|
126
76
|
identifier: (0, _first["default"])(designViewIdentifiers)
|
|
127
77
|
};
|
|
128
78
|
}
|
|
129
|
-
|
|
130
79
|
var guessedDesignViewIdentifier = designViewIdentifiers.find(function (identifier) {
|
|
131
80
|
return identifier.indexOf(_this2._currentDesignView.identifier) !== -1;
|
|
132
81
|
});
|
|
133
|
-
|
|
134
82
|
if (guessedDesignViewIdentifier !== this._currentDesignView.identifier) {
|
|
135
83
|
this._currentDesignView = _objectSpread(_objectSpread({}, this._currentDesignView), {}, {
|
|
136
84
|
identifier: guessedDesignViewIdentifier
|
|
137
85
|
});
|
|
138
86
|
}
|
|
139
|
-
|
|
140
87
|
return this._currentDesignView;
|
|
141
88
|
}
|
|
142
89
|
}, {
|
|
143
90
|
key: "update",
|
|
144
91
|
value: function () {
|
|
145
|
-
var _update = _asyncToGenerator( /*#__PURE__*/
|
|
146
|
-
return
|
|
147
|
-
while (1) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
case "end":
|
|
157
|
-
return _context.stop();
|
|
158
|
-
}
|
|
92
|
+
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configuration) {
|
|
93
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
94
|
+
while (1) switch (_context.prev = _context.next) {
|
|
95
|
+
case 0:
|
|
96
|
+
this._configuration = configuration;
|
|
97
|
+
this._viewImages = (0, _get2["default"])(configuration, "visualizationData.viewImages", {});
|
|
98
|
+
_context.next = 4;
|
|
99
|
+
return this.updateCurrentView();
|
|
100
|
+
case 4:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context.stop();
|
|
159
103
|
}
|
|
160
104
|
}, _callee, this);
|
|
161
105
|
}));
|
|
162
|
-
|
|
163
106
|
function update(_x) {
|
|
164
107
|
return _update.apply(this, arguments);
|
|
165
108
|
}
|
|
166
|
-
|
|
167
109
|
return update;
|
|
168
110
|
}()
|
|
169
111
|
}, {
|
|
170
112
|
key: "updateCurrentView",
|
|
171
113
|
value: function () {
|
|
172
|
-
var _updateCurrentView = _asyncToGenerator( /*#__PURE__*/
|
|
173
|
-
return
|
|
174
|
-
while (1) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
case "end":
|
|
182
|
-
return _context2.stop();
|
|
183
|
-
}
|
|
114
|
+
var _updateCurrentView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
115
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
116
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
117
|
+
case 0:
|
|
118
|
+
_context2.next = 2;
|
|
119
|
+
return this.updateView(this.getCurrentDesignView());
|
|
120
|
+
case 2:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context2.stop();
|
|
184
123
|
}
|
|
185
124
|
}, _callee2, this);
|
|
186
125
|
}));
|
|
187
|
-
|
|
188
126
|
function updateCurrentView() {
|
|
189
127
|
return _updateCurrentView.apply(this, arguments);
|
|
190
128
|
}
|
|
191
|
-
|
|
192
129
|
return updateCurrentView;
|
|
193
130
|
}()
|
|
194
131
|
}, {
|
|
@@ -199,77 +136,65 @@ var Three2DLayers = /*#__PURE__*/function (_Three2D) {
|
|
|
199
136
|
}, {
|
|
200
137
|
key: "loadView",
|
|
201
138
|
value: function () {
|
|
202
|
-
var _loadView = _asyncToGenerator( /*#__PURE__*/
|
|
203
|
-
var _this$_currentDesignV
|
|
204
|
-
|
|
139
|
+
var _loadView = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
140
|
+
var _this$_currentDesignV;
|
|
205
141
|
var rerender,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (rerender) {
|
|
258
|
-
this.render();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
case 22:
|
|
262
|
-
case "end":
|
|
263
|
-
return _context3.stop();
|
|
264
|
-
}
|
|
142
|
+
imageURLs,
|
|
143
|
+
images,
|
|
144
|
+
originalSize,
|
|
145
|
+
_createWorkingCanvas,
|
|
146
|
+
_createWorkingCanvas2,
|
|
147
|
+
canvas,
|
|
148
|
+
ctx,
|
|
149
|
+
useOriginalImageSize,
|
|
150
|
+
combinedTexture,
|
|
151
|
+
_args3 = arguments;
|
|
152
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
153
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
154
|
+
case 0:
|
|
155
|
+
rerender = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
156
|
+
imageURLs = this.getModelPath();
|
|
157
|
+
if (!(!imageURLs || !imageURLs.length)) {
|
|
158
|
+
_context3.next = 5;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
this._clearIfEmpty && this._model && this.scene.remove(this._model);
|
|
162
|
+
return _context3.abrupt("return");
|
|
163
|
+
case 5:
|
|
164
|
+
this.onLoadStart();
|
|
165
|
+
_context3.next = 8;
|
|
166
|
+
return this._imageRepository.loadImages(imageURLs);
|
|
167
|
+
case 8:
|
|
168
|
+
images = _context3.sent;
|
|
169
|
+
this.onLoadFinished();
|
|
170
|
+
originalSize = (0, _getImageSize.getImageSize)(images[0]);
|
|
171
|
+
_createWorkingCanvas = (0, _createCanvas.createWorkingCanvas)(originalSize), _createWorkingCanvas2 = _slicedToArray(_createWorkingCanvas, 2), canvas = _createWorkingCanvas2[0], ctx = _createWorkingCanvas2[1];
|
|
172
|
+
images.forEach(function (image) {
|
|
173
|
+
ctx.drawImage(image, 0, 0);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
//@note: apply original image size for visualizations with no design areas (test phase)
|
|
177
|
+
useOriginalImageSize = !((_this$_currentDesignV = this._currentDesignView) !== null && _this$_currentDesignV !== void 0 && (_this$_currentDesignV = _this$_currentDesignV.designAreas) !== null && _this$_currentDesignV !== void 0 && _this$_currentDesignV.length);
|
|
178
|
+
combinedTexture = new _three.Texture(useOriginalImageSize ? canvas : (0, _optimizeTextureImage.optimizeTextureImage)(canvas));
|
|
179
|
+
combinedTexture.premultiplyAlpha = true;
|
|
180
|
+
combinedTexture.originalSize = originalSize;
|
|
181
|
+
combinedTexture.needsUpdate = true;
|
|
182
|
+
_context3.next = 20;
|
|
183
|
+
return this._initSync;
|
|
184
|
+
case 20:
|
|
185
|
+
this.initModelWithTexture(combinedTexture);
|
|
186
|
+
if (rerender) {
|
|
187
|
+
this.render();
|
|
188
|
+
}
|
|
189
|
+
case 22:
|
|
190
|
+
case "end":
|
|
191
|
+
return _context3.stop();
|
|
265
192
|
}
|
|
266
193
|
}, _callee3, this);
|
|
267
194
|
}));
|
|
268
|
-
|
|
269
195
|
function loadView() {
|
|
270
196
|
return _loadView.apply(this, arguments);
|
|
271
197
|
}
|
|
272
|
-
|
|
273
198
|
return loadView;
|
|
274
199
|
}()
|
|
275
200
|
}, {
|
|
@@ -281,7 +206,6 @@ var Three2DLayers = /*#__PURE__*/function (_Three2D) {
|
|
|
281
206
|
key: "getModelPath",
|
|
282
207
|
value: function getModelPath() {
|
|
283
208
|
var _this3 = this;
|
|
284
|
-
|
|
285
209
|
return this._modelPathList.map(function (path) {
|
|
286
210
|
return _this3._modelBasePath + path;
|
|
287
211
|
});
|
|
@@ -301,204 +225,156 @@ var Three2DLayers = /*#__PURE__*/function (_Three2D) {
|
|
|
301
225
|
var designArea = this._designAreaList.find(function (area) {
|
|
302
226
|
return area.designView.identifier === identifier;
|
|
303
227
|
});
|
|
304
|
-
|
|
305
228
|
return designArea && designArea.designView;
|
|
306
229
|
}
|
|
307
230
|
}, {
|
|
308
231
|
key: "getScreenshots",
|
|
309
232
|
value: function () {
|
|
310
|
-
var _getScreenshots = _asyncToGenerator( /*#__PURE__*/
|
|
233
|
+
var _getScreenshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(callback, _ref) {
|
|
311
234
|
var _this4 = this;
|
|
312
|
-
|
|
313
235
|
var designViewList, size, removeTempOverlay, screenshots, origDesignView, origCamera, origSize, origPixelRatio, restoreOriginalValues, camera, views, data, _iterator, _step, view, _this$getScreenshotSi, width, height, variant;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (this.renderer) {
|
|
322
|
-
_context5.next = 3;
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return _context5.abrupt("return", callback({}));
|
|
327
|
-
|
|
328
|
-
case 3:
|
|
329
|
-
this._screenshottingInProgress = true;
|
|
330
|
-
this.endAnimation();
|
|
331
|
-
_context5.next = 7;
|
|
332
|
-
return this.animationRunning();
|
|
333
|
-
|
|
334
|
-
case 7:
|
|
335
|
-
_context5.next = 9;
|
|
336
|
-
return this.createTempOverlay();
|
|
337
|
-
|
|
338
|
-
case 9:
|
|
339
|
-
removeTempOverlay = _context5.sent;
|
|
340
|
-
screenshots = {}; // store the original values for restoring afterwards
|
|
341
|
-
|
|
342
|
-
origDesignView = this.getCurrentDesignView();
|
|
343
|
-
origCamera = this.camera;
|
|
344
|
-
origSize = new _three.Vector2();
|
|
345
|
-
origPixelRatio = this.renderer.getPixelRatio();
|
|
346
|
-
this.renderer.getSize(origSize);
|
|
347
|
-
|
|
348
|
-
restoreOriginalValues = /*#__PURE__*/function () {
|
|
349
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
350
|
-
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
351
|
-
while (1) {
|
|
352
|
-
switch (_context4.prev = _context4.next) {
|
|
353
|
-
case 0:
|
|
354
|
-
_this4._screenshotCamera = null;
|
|
355
|
-
_this4._screenshottingInProgress = false;
|
|
356
|
-
_context4.next = 4;
|
|
357
|
-
return _this4.setView(_this4.getDesignViewByViewImageIdentifier(origDesignView.identifier) || origDesignView);
|
|
358
|
-
|
|
359
|
-
case 4:
|
|
360
|
-
_this4.renderer.setSize(origSize.width, origSize.height);
|
|
361
|
-
|
|
362
|
-
_this4.renderer.setPixelRatio(origPixelRatio);
|
|
363
|
-
|
|
364
|
-
_this4.camera = origCamera;
|
|
365
|
-
|
|
366
|
-
_this4.render();
|
|
367
|
-
|
|
368
|
-
removeTempOverlay();
|
|
369
|
-
|
|
370
|
-
case 9:
|
|
371
|
-
case "end":
|
|
372
|
-
return _context4.stop();
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}, _callee4);
|
|
376
|
-
}));
|
|
377
|
-
|
|
378
|
-
return function restoreOriginalValues() {
|
|
379
|
-
return _ref2.apply(this, arguments);
|
|
380
|
-
};
|
|
381
|
-
}();
|
|
382
|
-
|
|
383
|
-
camera = this.createCameraBase();
|
|
384
|
-
this._screenshotCamera = camera;
|
|
385
|
-
views = designViewList || Object.keys(this._viewImages).map(function (identifier) {
|
|
386
|
-
return _this4.getDesignViewByViewImageIdentifier(identifier) || {
|
|
387
|
-
identifier: identifier
|
|
388
|
-
};
|
|
389
|
-
});
|
|
390
|
-
data = {};
|
|
391
|
-
_iterator = _createForOfIteratorHelper(views);
|
|
392
|
-
_context5.prev = 22;
|
|
393
|
-
|
|
394
|
-
_iterator.s();
|
|
395
|
-
|
|
396
|
-
case 24:
|
|
397
|
-
if ((_step = _iterator.n()).done) {
|
|
398
|
-
_context5.next = 51;
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
view = _step.value;
|
|
403
|
-
|
|
404
|
-
if (!this._abortScreenshotting) {
|
|
405
|
-
_context5.next = 30;
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
_context5.next = 29;
|
|
410
|
-
return restoreOriginalValues();
|
|
411
|
-
|
|
412
|
-
case 29:
|
|
413
|
-
return _context5.abrupt("return", _context5.sent);
|
|
414
|
-
|
|
415
|
-
case 30:
|
|
416
|
-
_context5.prev = 30;
|
|
417
|
-
_context5.next = 33;
|
|
418
|
-
return this.updateView(view);
|
|
419
|
-
|
|
420
|
-
case 33:
|
|
421
|
-
_this$getScreenshotSi = this.getScreenshotSize(size), width = _this$getScreenshotSi.width, height = _this$getScreenshotSi.height;
|
|
422
|
-
(0, _setOrthographicCameraSize.setOrthographicCameraSize)(camera, width, height);
|
|
423
|
-
this.renderer.setSize(width, height);
|
|
424
|
-
this.renderer.setPixelRatio(1);
|
|
425
|
-
camera.zoom = this.getZoomForSize({
|
|
426
|
-
width: width,
|
|
427
|
-
height: height
|
|
428
|
-
});
|
|
429
|
-
camera.updateProjectionMatrix();
|
|
430
|
-
_context5.next = 41;
|
|
431
|
-
return this.dispatchMaterialUpdateEvent({
|
|
432
|
-
screenshot: true
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
case 41:
|
|
436
|
-
// set size and pixel ratio right before rendering, to make sure they are correct
|
|
437
|
-
this.renderer.setSize(width, height);
|
|
438
|
-
this.renderer.setPixelRatio(1);
|
|
439
|
-
this.renderer.render(this.scene, camera);
|
|
440
|
-
data[view.identifier] = this.renderer.domElement.toDataURL("image/png");
|
|
441
|
-
_context5.next = 49;
|
|
236
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
237
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
238
|
+
case 0:
|
|
239
|
+
designViewList = _ref.designViewList, size = _ref.size;
|
|
240
|
+
if (this.renderer) {
|
|
241
|
+
_context5.next = 3;
|
|
442
242
|
break;
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
243
|
+
}
|
|
244
|
+
return _context5.abrupt("return", callback({}));
|
|
245
|
+
case 3:
|
|
246
|
+
this._screenshottingInProgress = true;
|
|
247
|
+
this.endAnimation();
|
|
248
|
+
_context5.next = 7;
|
|
249
|
+
return this.animationRunning();
|
|
250
|
+
case 7:
|
|
251
|
+
_context5.next = 9;
|
|
252
|
+
return this.createTempOverlay();
|
|
253
|
+
case 9:
|
|
254
|
+
removeTempOverlay = _context5.sent;
|
|
255
|
+
screenshots = {}; // store the original values for restoring afterwards
|
|
256
|
+
origDesignView = this.getCurrentDesignView();
|
|
257
|
+
origCamera = this.camera;
|
|
258
|
+
origSize = new _three.Vector2();
|
|
259
|
+
origPixelRatio = this.renderer.getPixelRatio();
|
|
260
|
+
this.renderer.getSize(origSize);
|
|
261
|
+
restoreOriginalValues = /*#__PURE__*/function () {
|
|
262
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
263
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
264
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
265
|
+
case 0:
|
|
266
|
+
_this4._screenshotCamera = null;
|
|
267
|
+
_this4._screenshottingInProgress = false;
|
|
268
|
+
_context4.next = 4;
|
|
269
|
+
return _this4.setView(_this4.getDesignViewByViewImageIdentifier(origDesignView.identifier) || origDesignView);
|
|
270
|
+
case 4:
|
|
271
|
+
_this4.renderer.setSize(origSize.width, origSize.height);
|
|
272
|
+
_this4.renderer.setPixelRatio(origPixelRatio);
|
|
273
|
+
_this4.camera = origCamera;
|
|
274
|
+
_this4.render();
|
|
275
|
+
removeTempOverlay();
|
|
276
|
+
case 9:
|
|
277
|
+
case "end":
|
|
278
|
+
return _context4.stop();
|
|
279
|
+
}
|
|
280
|
+
}, _callee4);
|
|
281
|
+
}));
|
|
282
|
+
return function restoreOriginalValues() {
|
|
283
|
+
return _ref2.apply(this, arguments);
|
|
284
|
+
};
|
|
285
|
+
}();
|
|
286
|
+
camera = this.createCameraBase();
|
|
287
|
+
this._screenshotCamera = camera;
|
|
288
|
+
views = designViewList || Object.keys(this._viewImages).map(function (identifier) {
|
|
289
|
+
return _this4.getDesignViewByViewImageIdentifier(identifier) || {
|
|
290
|
+
identifier: identifier
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
data = {};
|
|
294
|
+
_iterator = _createForOfIteratorHelper(views);
|
|
295
|
+
_context5.prev = 22;
|
|
296
|
+
_iterator.s();
|
|
297
|
+
case 24:
|
|
298
|
+
if ((_step = _iterator.n()).done) {
|
|
299
|
+
_context5.next = 51;
|
|
450
300
|
break;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
301
|
+
}
|
|
302
|
+
view = _step.value;
|
|
303
|
+
if (!this._abortScreenshotting) {
|
|
304
|
+
_context5.next = 30;
|
|
454
305
|
break;
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
306
|
+
}
|
|
307
|
+
_context5.next = 29;
|
|
308
|
+
return restoreOriginalValues();
|
|
309
|
+
case 29:
|
|
310
|
+
return _context5.abrupt("return", _context5.sent);
|
|
311
|
+
case 30:
|
|
312
|
+
_context5.prev = 30;
|
|
313
|
+
_context5.next = 33;
|
|
314
|
+
return this.updateView(view);
|
|
315
|
+
case 33:
|
|
316
|
+
_this$getScreenshotSi = this.getScreenshotSize(size), width = _this$getScreenshotSi.width, height = _this$getScreenshotSi.height;
|
|
317
|
+
(0, _setOrthographicCameraSize.setOrthographicCameraSize)(camera, width, height);
|
|
318
|
+
this.renderer.setSize(width, height);
|
|
319
|
+
this.renderer.setPixelRatio(1);
|
|
320
|
+
camera.zoom = this.getZoomForSize({
|
|
321
|
+
width: width,
|
|
322
|
+
height: height
|
|
323
|
+
});
|
|
324
|
+
camera.updateProjectionMatrix();
|
|
325
|
+
_context5.next = 41;
|
|
326
|
+
return this.dispatchMaterialUpdateEvent({
|
|
327
|
+
screenshot: true
|
|
328
|
+
});
|
|
329
|
+
case 41:
|
|
330
|
+
// set size and pixel ratio right before rendering, to make sure they are correct
|
|
331
|
+
this.renderer.setSize(width, height);
|
|
332
|
+
this.renderer.setPixelRatio(1);
|
|
333
|
+
this.renderer.render(this.scene, camera);
|
|
334
|
+
data[view.identifier] = this.renderer.domElement.toDataURL("image/png");
|
|
335
|
+
_context5.next = 49;
|
|
336
|
+
break;
|
|
337
|
+
case 47:
|
|
338
|
+
_context5.prev = 47;
|
|
339
|
+
_context5.t0 = _context5["catch"](30);
|
|
340
|
+
case 49:
|
|
341
|
+
_context5.next = 24;
|
|
342
|
+
break;
|
|
343
|
+
case 51:
|
|
344
|
+
_context5.next = 56;
|
|
345
|
+
break;
|
|
346
|
+
case 53:
|
|
347
|
+
_context5.prev = 53;
|
|
348
|
+
_context5.t1 = _context5["catch"](22);
|
|
349
|
+
_iterator.e(_context5.t1);
|
|
350
|
+
case 56:
|
|
351
|
+
_context5.prev = 56;
|
|
352
|
+
_iterator.f();
|
|
353
|
+
return _context5.finish(56);
|
|
354
|
+
case 59:
|
|
355
|
+
variant = (0, _get2["default"])(this._configuration, "item.identifier");
|
|
356
|
+
screenshots[variant] = data;
|
|
357
|
+
_context5.next = 63;
|
|
358
|
+
return restoreOriginalValues();
|
|
359
|
+
case 63:
|
|
360
|
+
callback(screenshots);
|
|
361
|
+
case 64:
|
|
362
|
+
case "end":
|
|
363
|
+
return _context5.stop();
|
|
482
364
|
}
|
|
483
365
|
}, _callee5, this, [[22, 53, 56, 59], [30, 47]]);
|
|
484
366
|
}));
|
|
485
|
-
|
|
486
367
|
function getScreenshots(_x2, _x3) {
|
|
487
368
|
return _getScreenshots.apply(this, arguments);
|
|
488
369
|
}
|
|
489
|
-
|
|
490
370
|
return getScreenshots;
|
|
491
371
|
}()
|
|
492
372
|
}, {
|
|
493
373
|
key: "dispose",
|
|
494
374
|
value: function dispose() {
|
|
495
375
|
_get(_getPrototypeOf(Three2DLayers.prototype), "dispose", this).call(this);
|
|
496
|
-
|
|
497
376
|
this._imageRepository.dispose();
|
|
498
377
|
}
|
|
499
378
|
}]);
|
|
500
|
-
|
|
501
379
|
return Three2DLayers;
|
|
502
|
-
}(_Three2D2.Three2D);
|
|
503
|
-
|
|
504
|
-
exports.Three2DLayers = Three2DLayers;
|
|
380
|
+
}(_Three2D2.Three2D);
|