redhotmagma-visualization 1.51.0 → 1.51.2

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.
Files changed (56) hide show
  1. package/AlignTargetProvider.js +21 -30
  2. package/CommonUtils/Deferred.js +11 -19
  3. package/CommonUtils/Observable.js +23 -30
  4. package/CommonUtils/PropertyObserver.js +4 -10
  5. package/CommonUtils/SyncCurrentFunction.js +25 -31
  6. package/CommonUtils/SyncObservableEvent.js +4 -10
  7. package/CommonUtils/pointerEvent.js +9 -15
  8. package/Constants.js +2 -8
  9. package/DevApp.js +224 -236
  10. package/ExposedModules.js +4 -19
  11. package/FallbackVisualization.js +5 -12
  12. package/PrintingEffects/ColorEmbossingEffect.js +13 -19
  13. package/PrintingEffects/DomingEffect.js +13 -19
  14. package/PrintingEffects/EmbossingEffect.js +14 -20
  15. package/PrintingEffects/EmbroideryEffect.js +113 -128
  16. package/PrintingEffects/EngravingEffect.js +14 -20
  17. package/PrintingEffects/PrintingEffects.js +40 -48
  18. package/PrintingEffects/PrintingEffectsUtils.js +4 -13
  19. package/React/ReactBase.js +29 -37
  20. package/Three/Exporters/glTFExporter.js +3 -10
  21. package/Three/Three2D.js +441 -470
  22. package/Three/Three2DLayers.js +136 -148
  23. package/Three/Three3D.js +285 -302
  24. package/Three/Three3DScene.js +326 -341
  25. package/Three/ThreeBase.js +92 -104
  26. package/Utils/DesignArea/getDesignAreaCanvasSize.js +3 -10
  27. package/Utils/TextureBuilder/createTextureBuilder.js +57 -69
  28. package/Utils/TextureBuilder/textureBuilderFunctions.js +4 -10
  29. package/Utils/canvasBlur.js +2 -8
  30. package/Utils/createAlphaMapFromAlphaChannel.js +8 -13
  31. package/Utils/createBakedShadow.js +18 -25
  32. package/Utils/createCache.js +1 -7
  33. package/Utils/createCanvas.js +1 -7
  34. package/Utils/createImageRepository.js +38 -53
  35. package/Utils/disposeMaterial.js +7 -12
  36. package/Utils/getImageSize.js +1 -7
  37. package/Utils/imagePreloader.js +22 -29
  38. package/Utils/initTextureCanvas.js +10 -17
  39. package/Utils/isMobileDevice.js +1 -7
  40. package/Utils/optimizeTextureImage.js +8 -13
  41. package/Utils/rememberCameraViewOffset.js +1 -7
  42. package/Utils/removeObject.js +3 -9
  43. package/Utils/restrictCameraMovement.js +5 -12
  44. package/Utils/setLightShadow.js +3 -9
  45. package/Utils/setOrthographicCameraSize.js +1 -7
  46. package/Utils/updateFitSizeToElement.js +5 -11
  47. package/VisualizationContainer.js +46 -55
  48. package/VisualizationInterface.js +42 -50
  49. package/VisualizationProvider.js +8 -15
  50. package/index.js +4 -7
  51. package/package.json +2 -2
  52. package/src/Three/Exporters/glTFExporter.js +1 -1
  53. package/src/Three/Three3D.js +4 -4
  54. package/src/Three/Three3DScene.js +13 -3
  55. package/src/Utils/restrictCameraMovement.js +1 -1
  56. package/visualizationAdapterCreator.js +18 -27
@@ -1,34 +1,29 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EffectCanvas = void 0;
7
- var _EmbossingEffect = require("./EmbossingEffect");
8
- var _EngravingEffect = require("./EngravingEffect");
9
- var _DomingEffect = require("./DomingEffect");
10
- var _EmbroideryEffect = require("./EmbroideryEffect");
11
- var _createCanvas = require("../Utils/createCanvas");
12
- var _ColorEmbossingEffect = require("./ColorEmbossingEffect");
13
1
  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); }
14
- 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; }
15
- 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); } }
16
- 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); }); }; }
17
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
3
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
4
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
5
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
6
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
18
7
  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."); }
19
- 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); }
20
- 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; }
8
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
9
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
21
10
  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; } }
22
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
- 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); } }
25
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
26
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
27
- 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); }
28
- var EffectCanvas = exports.EffectCanvas = /*#__PURE__*/function () {
11
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
12
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
13
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
14
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ import { embossingEffect } from "./EmbossingEffect";
18
+ import { engravingEffect } from "./EngravingEffect";
19
+ import { domingEffect } from "./DomingEffect";
20
+ import { embroideryEffect } from "./EmbroideryEffect";
21
+ import { createWorkingCanvas } from "../Utils/createCanvas";
22
+ import { colorEmbossingEffect } from "./ColorEmbossingEffect";
23
+ export var EffectCanvas = /*#__PURE__*/function () {
29
24
  function EffectCanvas(width, height) {
30
25
  _classCallCheck(this, EffectCanvas);
31
- var _createWorkingCanvas = (0, _createCanvas.createWorkingCanvas)({
26
+ var _createWorkingCanvas = createWorkingCanvas({
32
27
  width: width,
33
28
  height: height
34
29
  }),
@@ -38,38 +33,36 @@ var EffectCanvas = exports.EffectCanvas = /*#__PURE__*/function () {
38
33
  this.canvas = canvas;
39
34
  this.ctx = ctx;
40
35
  }
41
- _createClass(EffectCanvas, [{
36
+ return _createClass(EffectCanvas, [{
42
37
  key: "applyEffect",
43
38
  value: function () {
44
- var _applyEffect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(effect) {
39
+ var _applyEffect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(effect) {
45
40
  var options,
46
41
  effectFn,
47
- _args = arguments;
48
- return _regeneratorRuntime().wrap(function _callee$(_context) {
49
- while (1) switch (_context.prev = _context.next) {
42
+ _args = arguments,
43
+ _t;
44
+ return _regenerator().w(function (_context) {
45
+ while (1) switch (_context.n) {
50
46
  case 0:
51
47
  options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
52
48
  effectFn = {
53
- embossing: _EmbossingEffect.embossingEffect,
54
- engraving: _EngravingEffect.engravingEffect,
55
- doming: _DomingEffect.domingEffect,
56
- embroidery: _EmbroideryEffect.embroideryEffect,
57
- color_embossing: _ColorEmbossingEffect.colorEmbossingEffect
49
+ embossing: embossingEffect,
50
+ engraving: engravingEffect,
51
+ doming: domingEffect,
52
+ embroidery: embroideryEffect,
53
+ color_embossing: colorEmbossingEffect
58
54
  }[effect];
59
- _context.t0 = effectFn;
60
- if (!_context.t0) {
61
- _context.next = 7;
55
+ _t = effectFn;
56
+ if (!_t) {
57
+ _context.n = 2;
62
58
  break;
63
59
  }
64
- _context.next = 6;
60
+ _context.n = 1;
65
61
  return effectFn(this.canvas, options);
66
- case 6:
67
- _context.t0 = _context.sent;
68
- case 7:
69
- return _context.abrupt("return", _context.t0);
70
- case 8:
71
- case "end":
72
- return _context.stop();
62
+ case 1:
63
+ _t = _context.v;
64
+ case 2:
65
+ return _context.a(2, _t);
73
66
  }
74
67
  }, _callee, this);
75
68
  }));
@@ -84,5 +77,4 @@ var EffectCanvas = exports.EffectCanvas = /*#__PURE__*/function () {
84
77
  ctx.drawImage(this.canvas, 0, 0);
85
78
  }
86
79
  }]);
87
- return EffectCanvas;
88
80
  }();
@@ -1,19 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createBackgroundCanvas = createBackgroundCanvas;
7
- exports.createNegativeCanvas = createNegativeCanvas;
8
- exports.createShadowCanvas = createShadowCanvas;
9
- exports.getNewCanvas = getNewCanvas;
10
- function getNewCanvas(width, height) {
1
+ export function getNewCanvas(width, height) {
11
2
  var canvas = document.createElement("canvas");
12
3
  canvas.width = width;
13
4
  canvas.height = height;
14
5
  return canvas;
15
6
  }
16
- function createBackgroundCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight) {
7
+ export function createBackgroundCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight) {
17
8
  var backgroundCanvas = getNewCanvas(canvasWidth, canvasHeight);
18
9
  var backgroundContext = backgroundCanvas.getContext("2d");
19
10
  backgroundContext.drawImage(baseCanvas, 0, 0);
@@ -22,7 +13,7 @@ function createBackgroundCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight
22
13
  backgroundContext.fillRect(0, 0, canvasWidth, canvasHeight);
23
14
  return backgroundCanvas;
24
15
  }
25
- function createNegativeCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight) {
16
+ export function createNegativeCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight) {
26
17
  var negativeCanvas = getNewCanvas(canvasWidth, canvasHeight);
27
18
  var negativeContext = negativeCanvas.getContext("2d");
28
19
  negativeContext.fillStyle = fillColor;
@@ -31,7 +22,7 @@ function createNegativeCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight)
31
22
  negativeContext.drawImage(baseCanvas, 0, 0);
32
23
  return negativeCanvas;
33
24
  }
34
- function createShadowCanvas(baseCanvas, shadows, canvasWidth, canvasHeight) {
25
+ export function createShadowCanvas(baseCanvas, shadows, canvasWidth, canvasHeight) {
35
26
  var shadowCanvas = getNewCanvas(canvasWidth, canvasHeight);
36
27
  var shadowContext = shadowCanvas.getContext("2d");
37
28
  for (var i = 0; i < shadows.length; i++) {
@@ -1,29 +1,23 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ReactBase = void 0;
7
- var _reactDom = _interopRequireDefault(require("react-dom"));
8
- var _react = _interopRequireDefault(require("react"));
9
- var _VisualizationInterface = require("../VisualizationInterface");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
1
  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); }
12
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
- 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); } }
14
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
15
- 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); }
16
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
17
- 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); }
18
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
19
- 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); }; }
20
- 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); }
21
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
22
- 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; } }
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
- 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; }
25
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
26
- 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); }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
7
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
10
+ function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
11
+ function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
12
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
13
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
14
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ import ReactDOM from "react-dom";
19
+ import React from "react";
20
+ import { VisualizationInterface } from "../VisualizationInterface";
27
21
  var NoComponent = function NoComponent() {
28
22
  return null;
29
23
  };
@@ -31,21 +25,20 @@ var NoComponent = function NoComponent() {
31
25
  /**
32
26
  * A base class for React based visualizations which renders the given Component in the container element
33
27
  */
34
- var ReactBase = exports.ReactBase = /*#__PURE__*/function (_VisualizationInterfa) {
35
- _inherits(ReactBase, _VisualizationInterfa);
36
- var _super = _createSuper(ReactBase);
28
+ export var ReactBase = /*#__PURE__*/function (_VisualizationInterfa) {
37
29
  function ReactBase(cfg) {
38
30
  var _this;
39
31
  _classCallCheck(this, ReactBase);
40
- _this = _super.call(this, cfg);
41
- _defineProperty(_assertThisInitialized(_this), "_container", null);
42
- _defineProperty(_assertThisInitialized(_this), "Component", NoComponent);
32
+ _this = _callSuper(this, ReactBase, [cfg]);
33
+ _defineProperty(_this, "_container", null);
34
+ _defineProperty(_this, "Component", NoComponent);
43
35
  if (cfg.Component) {
44
36
  _this.Component = cfg.Component;
45
37
  }
46
38
  return _this;
47
39
  }
48
- _createClass(ReactBase, [{
40
+ _inherits(ReactBase, _VisualizationInterfa);
41
+ return _createClass(ReactBase, [{
49
42
  key: "init",
50
43
  value: function init() {
51
44
  var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.createElement("div");
@@ -64,16 +57,15 @@ var ReactBase = exports.ReactBase = /*#__PURE__*/function (_VisualizationInterfa
64
57
  value: function render() {
65
58
  var Component = this.Component,
66
59
  _container = this._container;
67
- _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(Component, null), _container);
60
+ ReactDOM.render(/*#__PURE__*/React.createElement(Component, null), _container);
68
61
  }
69
62
  }, {
70
63
  key: "dispose",
71
64
  value: function dispose() {
72
- _get(_getPrototypeOf(ReactBase.prototype), "dispose", this).call(this);
65
+ _superPropGet(ReactBase, "dispose", this, 3)([]);
73
66
  if (this._container) {
74
- _reactDom["default"].unmountComponentAtNode(this._container);
67
+ ReactDOM.unmountComponentAtNode(this._container);
75
68
  }
76
69
  }
77
70
  }]);
78
- return ReactBase;
79
- }(_VisualizationInterface.VisualizationInterface);
71
+ }(VisualizationInterface);
@@ -1,13 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.exportGLTF = exportGLTF;
7
- var _GLTFExporter = require("three/examples/jsm/exporters/GLTFExporter");
8
- function exportGLTF(input) {
1
+ import { GLTFExporter } from "three/addons/exporters/GLTFExporter";
2
+ export function exportGLTF(input) {
9
3
  var filename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "scene";
10
- var gltfExporter = new _GLTFExporter.GLTFExporter();
4
+ var gltfExporter = new GLTFExporter();
11
5
  var options = {
12
6
  binary: true,
13
7
  includeCustomExtensions: true
@@ -31,7 +25,6 @@ function save(blob, filename) {
31
25
  document.body.removeChild(link);
32
26
  // URL.revokeObjectURL( url ); breaks Firefox...
33
27
  }
34
-
35
28
  function saveString(text, filename) {
36
29
  save(new Blob([text], {
37
30
  type: "text/plain"