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/DevApp.js
CHANGED
|
@@ -1,68 +1,40 @@
|
|
|
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["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _root = require("react-hot-loader/root");
|
|
11
|
-
|
|
12
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
8
|
var _VisualizationProvider = require("./VisualizationProvider");
|
|
15
|
-
|
|
16
9
|
var _VisualizationContainer = _interopRequireDefault(require("./VisualizationContainer"));
|
|
17
|
-
|
|
18
10
|
var _visualizationAdapterCreator = require("./visualizationAdapterCreator");
|
|
19
|
-
|
|
20
11
|
var _designAreaList2D = _interopRequireDefault(require("./__mocks__/designAreaList2D"));
|
|
21
|
-
|
|
22
12
|
var _designAreaList2DVariant = _interopRequireDefault(require("./__mocks__/designAreaList2DVariant"));
|
|
23
|
-
|
|
24
13
|
var _designAreaList3DVariant = _interopRequireDefault(require("./__mocks__/designAreaList3DVariant"));
|
|
25
|
-
|
|
26
14
|
var _exportedSampleSvg = require("./__mocks__/exportedSampleSvg");
|
|
27
|
-
|
|
28
15
|
var _AlignTargetProvider = require("./AlignTargetProvider");
|
|
29
|
-
|
|
30
16
|
var _Constants = require("./Constants");
|
|
31
|
-
|
|
32
17
|
var _three = require("three");
|
|
33
|
-
|
|
34
18
|
var _makeStyles = _interopRequireDefault(require("@material-ui/core/styles/makeStyles"));
|
|
35
|
-
|
|
36
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
37
|
-
|
|
38
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
|
-
|
|
40
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
|
-
|
|
22
|
+
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); }
|
|
42
23
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
|
-
|
|
44
24
|
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."); }
|
|
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 _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
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
-
|
|
50
|
-
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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
51
|
-
|
|
27
|
+
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; } } }; }
|
|
52
28
|
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); }
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
56
31
|
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); } }
|
|
57
|
-
|
|
58
32
|
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); }); }; }
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
65
|
-
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
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; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
37
|
+
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); }
|
|
66
38
|
var adapterConfig = (0, _visualizationAdapterCreator.createAdapterConfig)({
|
|
67
39
|
host: "/"
|
|
68
40
|
}, {
|
|
@@ -361,7 +333,6 @@ var modelData = {
|
|
|
361
333
|
}
|
|
362
334
|
}
|
|
363
335
|
};
|
|
364
|
-
|
|
365
336
|
var getDemoData = function getDemoData(mode, model) {
|
|
366
337
|
var demoData = {
|
|
367
338
|
"2dVariant": {
|
|
@@ -391,114 +362,87 @@ var getDemoData = function getDemoData(mode, model) {
|
|
|
391
362
|
};
|
|
392
363
|
return demoData[mode];
|
|
393
364
|
};
|
|
394
|
-
|
|
395
365
|
var loadDemoModel = /*#__PURE__*/function () {
|
|
396
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
366
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(visualization, mode, model) {
|
|
397
367
|
var _getDemoData, configuration, view, designAreaList, itemPath, materialPath;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
_context.t0 = visualization.update && configuration;
|
|
405
|
-
|
|
406
|
-
if (!_context.t0) {
|
|
407
|
-
_context.next = 5;
|
|
408
|
-
break;
|
|
409
|
-
}
|
|
410
|
-
|
|
368
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
369
|
+
while (1) switch (_context.prev = _context.next) {
|
|
370
|
+
case 0:
|
|
371
|
+
_getDemoData = getDemoData(mode, model), configuration = _getDemoData.configuration, view = _getDemoData.view, designAreaList = _getDemoData.designAreaList, itemPath = _getDemoData.itemPath, materialPath = _getDemoData.materialPath;
|
|
372
|
+
_context.t0 = visualization.update && configuration;
|
|
373
|
+
if (!_context.t0) {
|
|
411
374
|
_context.next = 5;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
_context.next = 5;
|
|
378
|
+
return visualization.update(configuration);
|
|
379
|
+
case 5:
|
|
380
|
+
_context.t1 = itemPath;
|
|
381
|
+
if (!_context.t1) {
|
|
422
382
|
_context.next = 9;
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
_context.next = 9;
|
|
386
|
+
return visualization.updateItemPath(itemPath);
|
|
387
|
+
case 9:
|
|
388
|
+
_context.t2 = materialPath;
|
|
389
|
+
if (!_context.t2) {
|
|
433
390
|
_context.next = 13;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
break;
|
|
442
|
-
}
|
|
443
|
-
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
_context.next = 13;
|
|
394
|
+
return visualization.updateMaterialVariantPath(materialPath);
|
|
395
|
+
case 13:
|
|
396
|
+
_context.t3 = designAreaList;
|
|
397
|
+
if (!_context.t3) {
|
|
444
398
|
_context.next = 17;
|
|
445
|
-
return visualization.updateDesignAreaList(designAreaList);
|
|
446
|
-
|
|
447
|
-
case 17:
|
|
448
|
-
_context.t4 = view;
|
|
449
|
-
|
|
450
|
-
if (!_context.t4) {
|
|
451
|
-
_context.next = 26;
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
if (!visualization.setView) {
|
|
456
|
-
_context.next = 24;
|
|
457
|
-
break;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
_context.next = 22;
|
|
461
|
-
return visualization.setView(view);
|
|
462
|
-
|
|
463
|
-
case 22:
|
|
464
|
-
_context.next = 26;
|
|
465
399
|
break;
|
|
466
|
-
|
|
467
|
-
|
|
400
|
+
}
|
|
401
|
+
_context.next = 17;
|
|
402
|
+
return visualization.updateDesignAreaList(designAreaList);
|
|
403
|
+
case 17:
|
|
404
|
+
_context.t4 = view;
|
|
405
|
+
if (!_context.t4) {
|
|
468
406
|
_context.next = 26;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
if (!visualization.setView) {
|
|
410
|
+
_context.next = 24;
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
_context.next = 22;
|
|
414
|
+
return visualization.setView(view);
|
|
415
|
+
case 22:
|
|
416
|
+
_context.next = 26;
|
|
417
|
+
break;
|
|
418
|
+
case 24:
|
|
419
|
+
_context.next = 26;
|
|
420
|
+
return visualization.jumpToView(view);
|
|
421
|
+
case 26:
|
|
422
|
+
case "end":
|
|
423
|
+
return _context.stop();
|
|
475
424
|
}
|
|
476
425
|
}, _callee);
|
|
477
426
|
}));
|
|
478
|
-
|
|
479
427
|
return function loadDemoModel(_x, _x2, _x3) {
|
|
480
428
|
return _ref.apply(this, arguments);
|
|
481
429
|
};
|
|
482
430
|
}();
|
|
483
|
-
|
|
484
431
|
function strokeStar(ctx, x, y, r, n, inset) {
|
|
485
432
|
ctx.save();
|
|
486
433
|
ctx.beginPath();
|
|
487
434
|
ctx.translate(x, y);
|
|
488
435
|
ctx.moveTo(0, 0 - r);
|
|
489
|
-
|
|
490
436
|
for (var i = 0; i < n; i++) {
|
|
491
437
|
ctx.rotate(Math.PI / n);
|
|
492
438
|
ctx.lineTo(0, 0 - r * inset);
|
|
493
439
|
ctx.rotate(Math.PI / n);
|
|
494
440
|
ctx.lineTo(0, 0 - r);
|
|
495
441
|
}
|
|
496
|
-
|
|
497
442
|
ctx.closePath();
|
|
498
443
|
ctx.fill();
|
|
499
444
|
ctx.restore();
|
|
500
445
|
}
|
|
501
|
-
|
|
502
446
|
function drawImage(ctx, scaling, effect) {
|
|
503
447
|
ctx.save();
|
|
504
448
|
ctx.scale(scaling, scaling);
|
|
@@ -508,118 +452,91 @@ function drawImage(ctx, scaling, effect) {
|
|
|
508
452
|
strokeStar(ctx, 100, 20, 5, 5, 2);
|
|
509
453
|
ctx.restore();
|
|
510
454
|
}
|
|
511
|
-
|
|
512
455
|
var drawToTexture = function drawToTexture(effect, designAreaList) {
|
|
513
456
|
return /*#__PURE__*/function () {
|
|
514
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
457
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(textureCtx, getTextureBuilder) {
|
|
515
458
|
var designAreas,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
});
|
|
559
|
-
|
|
560
|
-
_iterator.s();
|
|
561
|
-
|
|
562
|
-
case 7:
|
|
563
|
-
if ((_step = _iterator.n()).done) {
|
|
564
|
-
_context3.next = 11;
|
|
565
|
-
break;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return _context3.delegateYield(_loop(), "t0", 9);
|
|
569
|
-
|
|
570
|
-
case 9:
|
|
571
|
-
_context3.next = 7;
|
|
572
|
-
break;
|
|
573
|
-
|
|
574
|
-
case 11:
|
|
575
|
-
_context3.next = 16;
|
|
459
|
+
_getTextureBuilder,
|
|
460
|
+
drawCanvasToArea,
|
|
461
|
+
highlightDesignAreas,
|
|
462
|
+
drawOn,
|
|
463
|
+
_iterator,
|
|
464
|
+
_step,
|
|
465
|
+
_loop,
|
|
466
|
+
_args3 = arguments;
|
|
467
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
468
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
469
|
+
case 0:
|
|
470
|
+
designAreas = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : designAreaList;
|
|
471
|
+
_getTextureBuilder = getTextureBuilder(textureBuilderConfig), drawCanvasToArea = _getTextureBuilder.drawCanvasToArea, highlightDesignAreas = _getTextureBuilder.highlightDesignAreas, drawOn = _getTextureBuilder.drawOn;
|
|
472
|
+
highlightDesignAreas(designAreas);
|
|
473
|
+
_iterator = _createForOfIteratorHelper(designAreas);
|
|
474
|
+
_context3.prev = 4;
|
|
475
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
476
|
+
var designArea;
|
|
477
|
+
return _regeneratorRuntime().wrap(function _loop$(_context2) {
|
|
478
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
479
|
+
case 0:
|
|
480
|
+
designArea = _step.value;
|
|
481
|
+
_context2.next = 3;
|
|
482
|
+
return drawCanvasToArea({
|
|
483
|
+
drawToContext: function drawToContext(ctx, x, y, width) {
|
|
484
|
+
drawImage(ctx, width / designArea.position.width, effect);
|
|
485
|
+
},
|
|
486
|
+
designArea: designArea,
|
|
487
|
+
effect: effect,
|
|
488
|
+
effectOptions: effectOptions[effect],
|
|
489
|
+
getSvg: _exportedSampleSvg.getExportedSampleSvg
|
|
490
|
+
});
|
|
491
|
+
case 3:
|
|
492
|
+
case "end":
|
|
493
|
+
return _context2.stop();
|
|
494
|
+
}
|
|
495
|
+
}, _loop);
|
|
496
|
+
});
|
|
497
|
+
_iterator.s();
|
|
498
|
+
case 7:
|
|
499
|
+
if ((_step = _iterator.n()).done) {
|
|
500
|
+
_context3.next = 11;
|
|
576
501
|
break;
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
502
|
+
}
|
|
503
|
+
return _context3.delegateYield(_loop(), "t0", 9);
|
|
504
|
+
case 9:
|
|
505
|
+
_context3.next = 7;
|
|
506
|
+
break;
|
|
507
|
+
case 11:
|
|
508
|
+
_context3.next = 16;
|
|
509
|
+
break;
|
|
510
|
+
case 13:
|
|
511
|
+
_context3.prev = 13;
|
|
512
|
+
_context3.t1 = _context3["catch"](4);
|
|
513
|
+
_iterator.e(_context3.t1);
|
|
514
|
+
case 16:
|
|
515
|
+
_context3.prev = 16;
|
|
516
|
+
_iterator.f();
|
|
517
|
+
return _context3.finish(16);
|
|
518
|
+
case 19:
|
|
519
|
+
drawOn(textureCtx);
|
|
520
|
+
case 20:
|
|
521
|
+
case "end":
|
|
522
|
+
return _context3.stop();
|
|
598
523
|
}
|
|
599
524
|
}, _callee2, null, [[4, 13, 16, 19]]);
|
|
600
525
|
}));
|
|
601
|
-
|
|
602
526
|
return function (_x4, _x5) {
|
|
603
527
|
return _ref2.apply(this, arguments);
|
|
604
528
|
};
|
|
605
529
|
}();
|
|
606
530
|
};
|
|
607
|
-
|
|
608
531
|
var addTexture = function addTexture(visualization, mode, model, effect) {
|
|
609
|
-
visualization.getDrawingContext(drawToTexture(effect, getDemoData(mode, model).designAreaList), true
|
|
610
|
-
/* update alpha */
|
|
611
|
-
, true
|
|
612
|
-
/* clean up texture before drawing */
|
|
613
|
-
);
|
|
532
|
+
visualization.getDrawingContext(drawToTexture(effect, getDemoData(mode, model).designAreaList), true /* update alpha */, true /* clean up texture before drawing */);
|
|
614
533
|
};
|
|
615
534
|
|
|
616
535
|
var expose = function expose(name, value) {
|
|
617
536
|
return window[name] = value;
|
|
618
537
|
};
|
|
619
|
-
|
|
620
538
|
var AlignTestComponent = (0, _AlignTargetProvider.withAlignTarget)(function (props) {
|
|
621
539
|
var ref = /*#__PURE__*/_react["default"].createRef();
|
|
622
|
-
|
|
623
540
|
(0, _react.useEffect)(function () {
|
|
624
541
|
props.alignTarget.add(ref.current);
|
|
625
542
|
return function () {
|
|
@@ -646,15 +563,12 @@ var AlignTestComponent = (0, _AlignTargetProvider.withAlignTarget)(function (pro
|
|
|
646
563
|
elementRef: ref
|
|
647
564
|
}) : props.children);
|
|
648
565
|
});
|
|
649
|
-
|
|
650
566
|
var MovementRestrictButton = function MovementRestrictButton(_ref3) {
|
|
651
567
|
var visualization = _ref3.visualization;
|
|
652
|
-
|
|
653
568
|
var _useState = (0, _react.useState)(false),
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
569
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
570
|
+
isMovementRestricted = _useState2[0],
|
|
571
|
+
restrictMovement = _useState2[1];
|
|
658
572
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
659
573
|
className: "feature"
|
|
660
574
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
@@ -669,21 +583,17 @@ var MovementRestrictButton = function MovementRestrictButton(_ref3) {
|
|
|
669
583
|
}
|
|
670
584
|
}, isMovementRestricted ? "Release movement restriction" : "Restrict movement"));
|
|
671
585
|
};
|
|
672
|
-
|
|
673
586
|
var ViewSwitchOptions = function ViewSwitchOptions(_ref4) {
|
|
674
587
|
var visualization = _ref4.visualization,
|
|
675
|
-
|
|
676
|
-
|
|
588
|
+
mode = _ref4.mode;
|
|
677
589
|
var _useState3 = (0, _react.useState)(getDemoData(mode).view),
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
590
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
591
|
+
designView = _useState4[0],
|
|
592
|
+
setDesignView = _useState4[1];
|
|
682
593
|
var _useState5 = (0, _react.useState)(""),
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
594
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
595
|
+
designArea = _useState6[0],
|
|
596
|
+
setDesignArea = _useState6[1];
|
|
687
597
|
(0, _react.useEffect)(function () {
|
|
688
598
|
visualization.setView && visualization.setView(designView);
|
|
689
599
|
setDesignArea("");
|
|
@@ -722,10 +632,9 @@ var ViewSwitchOptions = function ViewSwitchOptions(_ref4) {
|
|
|
722
632
|
}, identifier);
|
|
723
633
|
})));
|
|
724
634
|
};
|
|
725
|
-
|
|
726
635
|
var CameraViews = function CameraViews(_ref9) {
|
|
727
636
|
var visualization = _ref9.visualization,
|
|
728
|
-
|
|
637
|
+
cameras = _ref9.cameras;
|
|
729
638
|
(0, _react.useEffect)(function () {
|
|
730
639
|
visualization && visualization.jumpToView && visualization.jumpToView("default");
|
|
731
640
|
}, [cameras]);
|
|
@@ -744,10 +653,9 @@ var CameraViews = function CameraViews(_ref9) {
|
|
|
744
653
|
}, name);
|
|
745
654
|
})));
|
|
746
655
|
};
|
|
747
|
-
|
|
748
656
|
var Animations = function Animations(_ref11) {
|
|
749
657
|
var visualization = _ref11.visualization,
|
|
750
|
-
|
|
658
|
+
animations = _ref11.animations;
|
|
751
659
|
if (!visualization || !animations || !animations.length) return null;
|
|
752
660
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
753
661
|
className: "feature"
|
|
@@ -763,10 +671,9 @@ var Animations = function Animations(_ref11) {
|
|
|
763
671
|
}, name);
|
|
764
672
|
})));
|
|
765
673
|
};
|
|
766
|
-
|
|
767
674
|
var ColorVariants = function ColorVariants(_ref13) {
|
|
768
675
|
var visualization = _ref13.visualization,
|
|
769
|
-
|
|
676
|
+
variants = _ref13.variants;
|
|
770
677
|
if (!visualization) return null;
|
|
771
678
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
772
679
|
className: "feature"
|
|
@@ -782,19 +689,15 @@ var ColorVariants = function ColorVariants(_ref13) {
|
|
|
782
689
|
}, name);
|
|
783
690
|
})));
|
|
784
691
|
};
|
|
785
|
-
|
|
786
692
|
var FeatureAvailability = function FeatureAvailability(_ref15) {
|
|
787
693
|
var availableFor = _ref15.availableFor,
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
694
|
+
mode = _ref15.mode,
|
|
695
|
+
children = _ref15.children;
|
|
791
696
|
if (-1 !== availableFor.indexOf(mode)) {
|
|
792
697
|
return children;
|
|
793
698
|
}
|
|
794
|
-
|
|
795
699
|
return null;
|
|
796
700
|
};
|
|
797
|
-
|
|
798
701
|
var useStyles = (0, _makeStyles["default"])({
|
|
799
702
|
container: {
|
|
800
703
|
position: "absolute",
|
|
@@ -826,66 +729,53 @@ var useStyles = (0, _makeStyles["default"])({
|
|
|
826
729
|
fontStyle: "italic"
|
|
827
730
|
}
|
|
828
731
|
});
|
|
829
|
-
|
|
830
732
|
var App = function App() {
|
|
831
733
|
var _useState7 = (0, _react.useState)("3dScene"),
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
734
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
735
|
+
mode = _useState8[0],
|
|
736
|
+
setMode = _useState8[1];
|
|
836
737
|
var _useState9 = (0, _react.useState)(""),
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
738
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
739
|
+
model = _useState10[0],
|
|
740
|
+
setModel = _useState10[1];
|
|
841
741
|
var _useState11 = (0, _react.useState)(),
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
742
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
743
|
+
visualization = _useState12[0],
|
|
744
|
+
setVisualization = _useState12[1];
|
|
846
745
|
var _useState13 = (0, _react.useState)(false),
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
746
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
747
|
+
showAlignTestComponent = _useState14[0],
|
|
748
|
+
setShowAlignTestComponent = _useState14[1];
|
|
851
749
|
var _useState15 = (0, _react.useState)(""),
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
750
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
751
|
+
effect = _useState16[0],
|
|
752
|
+
setEffect = _useState16[1];
|
|
856
753
|
var _useState17 = (0, _react.useState)({}),
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
754
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
755
|
+
features = _useState18[0],
|
|
756
|
+
setFeatures = _useState18[1];
|
|
861
757
|
(0, _react.useEffect)(function () {
|
|
862
758
|
visualization && visualization.dispose();
|
|
863
759
|
var mappedMode = {
|
|
864
760
|
"3dVariant": "3dScene" // the variant mode is deprecated, the demo is made with the 3dScene
|
|
865
|
-
|
|
866
761
|
}[mode] || mode;
|
|
867
|
-
|
|
868
762
|
var _visualization = (0, _visualizationAdapterCreator.createVisualizationAdapter)(adapterConfig, mappedMode);
|
|
869
|
-
|
|
870
763
|
setVisualization(_visualization);
|
|
871
764
|
setEffect("");
|
|
872
765
|
setModel("");
|
|
873
766
|
}, [mode]);
|
|
874
767
|
(0, _react.useEffect)(function () {
|
|
875
768
|
var drawFn = function drawFn() {
|
|
876
|
-
visualization.getDrawingContext(drawToTexture("print", getDemoData(mode, model).designAreaList), true
|
|
877
|
-
/* update alpha */
|
|
878
|
-
, true
|
|
879
|
-
/* clean up texture before drawing */
|
|
880
|
-
);
|
|
769
|
+
visualization.getDrawingContext(drawToTexture("print", getDemoData(mode, model).designAreaList), true /* update alpha */, true /* clean up texture before drawing */);
|
|
881
770
|
};
|
|
882
771
|
|
|
883
772
|
visualization && visualization.observable.on(_Constants.EventTypes.MaterialUpdated, drawFn);
|
|
884
773
|
return function () {
|
|
885
774
|
visualization && visualization.observable.off(_Constants.EventTypes.MaterialUpdated, drawFn);
|
|
886
775
|
};
|
|
887
|
-
}, [visualization, mode, model]);
|
|
776
|
+
}, [visualization, mode, model]);
|
|
888
777
|
|
|
778
|
+
// highlight intersected (clicked) object
|
|
889
779
|
(0, _react.useEffect)(function () {
|
|
890
780
|
if (visualization) {
|
|
891
781
|
var restoreColor;
|
|
@@ -900,13 +790,11 @@ var App = function App() {
|
|
|
900
790
|
mat.color = new _three.Color(1, 0.5, 0.5);
|
|
901
791
|
mat.updateNeeded = true;
|
|
902
792
|
visualization.render();
|
|
903
|
-
|
|
904
793
|
restoreColor = function restoreColor() {
|
|
905
794
|
mat.color = col;
|
|
906
795
|
mat.updateNeeded = true;
|
|
907
796
|
visualization.render();
|
|
908
797
|
};
|
|
909
|
-
|
|
910
798
|
to = window.setTimeout(restoreColor, 500);
|
|
911
799
|
});
|
|
912
800
|
}
|
|
@@ -942,38 +830,31 @@ var App = function App() {
|
|
|
942
830
|
key: model
|
|
943
831
|
}, model);
|
|
944
832
|
})), (!modelList || model) && /*#__PURE__*/_react["default"].createElement("button", {
|
|
945
|
-
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
833
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
946
834
|
var foundFeatures;
|
|
947
|
-
return
|
|
948
|
-
while (1) {
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
foundFeatures = {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
setFeatures(foundFeatures);
|
|
972
|
-
|
|
973
|
-
case 6:
|
|
974
|
-
case "end":
|
|
975
|
-
return _context4.stop();
|
|
976
|
-
}
|
|
835
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
836
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
837
|
+
case 0:
|
|
838
|
+
_context4.next = 2;
|
|
839
|
+
return loadDemoModel(visualization, mode, model);
|
|
840
|
+
case 2:
|
|
841
|
+
foundFeatures = {};
|
|
842
|
+
if (visualization.getCameras) {
|
|
843
|
+
foundFeatures.cameras = visualization.getCameras().map(function (_ref19) {
|
|
844
|
+
var name = _ref19.name;
|
|
845
|
+
return name;
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
if (visualization.getAnimations) {
|
|
849
|
+
foundFeatures.animations = visualization.getAnimations().map(function (_ref20) {
|
|
850
|
+
var name = _ref20.name;
|
|
851
|
+
return name;
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
setFeatures(foundFeatures);
|
|
855
|
+
case 6:
|
|
856
|
+
case "end":
|
|
857
|
+
return _context4.stop();
|
|
977
858
|
}
|
|
978
859
|
}, _callee3);
|
|
979
860
|
}))
|
|
@@ -1043,7 +924,4 @@ var App = function App() {
|
|
|
1043
924
|
autoDispose: true
|
|
1044
925
|
}))));
|
|
1045
926
|
};
|
|
1046
|
-
|
|
1047
|
-
var _default = (0, _root.hot)(App);
|
|
1048
|
-
|
|
1049
|
-
exports["default"] = _default;
|
|
927
|
+
var _default = exports["default"] = App;
|