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.
- package/AlignTargetProvider.js +21 -30
- package/CommonUtils/Deferred.js +11 -19
- package/CommonUtils/Observable.js +23 -30
- package/CommonUtils/PropertyObserver.js +4 -10
- package/CommonUtils/SyncCurrentFunction.js +25 -31
- package/CommonUtils/SyncObservableEvent.js +4 -10
- package/CommonUtils/pointerEvent.js +9 -15
- package/Constants.js +2 -8
- package/DevApp.js +224 -236
- package/ExposedModules.js +4 -19
- package/FallbackVisualization.js +5 -12
- package/PrintingEffects/ColorEmbossingEffect.js +13 -19
- package/PrintingEffects/DomingEffect.js +13 -19
- package/PrintingEffects/EmbossingEffect.js +14 -20
- package/PrintingEffects/EmbroideryEffect.js +113 -128
- package/PrintingEffects/EngravingEffect.js +14 -20
- package/PrintingEffects/PrintingEffects.js +40 -48
- package/PrintingEffects/PrintingEffectsUtils.js +4 -13
- package/React/ReactBase.js +29 -37
- package/Three/Exporters/glTFExporter.js +3 -10
- package/Three/Three2D.js +441 -470
- package/Three/Three2DLayers.js +136 -148
- package/Three/Three3D.js +285 -302
- package/Three/Three3DScene.js +326 -341
- package/Three/ThreeBase.js +92 -104
- package/Utils/DesignArea/getDesignAreaCanvasSize.js +3 -10
- package/Utils/TextureBuilder/createTextureBuilder.js +57 -69
- package/Utils/TextureBuilder/textureBuilderFunctions.js +4 -10
- package/Utils/canvasBlur.js +2 -8
- package/Utils/createAlphaMapFromAlphaChannel.js +8 -13
- package/Utils/createBakedShadow.js +18 -25
- package/Utils/createCache.js +1 -7
- package/Utils/createCanvas.js +1 -7
- package/Utils/createImageRepository.js +38 -53
- package/Utils/disposeMaterial.js +7 -12
- package/Utils/getImageSize.js +1 -7
- package/Utils/imagePreloader.js +22 -29
- package/Utils/initTextureCanvas.js +10 -17
- package/Utils/isMobileDevice.js +1 -7
- package/Utils/optimizeTextureImage.js +8 -13
- package/Utils/rememberCameraViewOffset.js +1 -7
- package/Utils/removeObject.js +3 -9
- package/Utils/restrictCameraMovement.js +5 -12
- package/Utils/setLightShadow.js +3 -9
- package/Utils/setOrthographicCameraSize.js +1 -7
- package/Utils/updateFitSizeToElement.js +5 -11
- package/VisualizationContainer.js +46 -55
- package/VisualizationInterface.js +42 -50
- package/VisualizationProvider.js +8 -15
- package/index.js +4 -7
- package/package.json +2 -2
- package/src/Three/Exporters/glTFExporter.js +1 -1
- package/src/Three/Three3D.js +4 -4
- package/src/Three/Three3DScene.js +13 -3
- package/src/Utils/restrictCameraMovement.js +1 -1
- 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
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
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(
|
|
20
|
-
function _arrayLikeToArray(
|
|
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(
|
|
23
|
-
function _classCallCheck(
|
|
24
|
-
function _defineProperties(
|
|
25
|
-
function _createClass(
|
|
26
|
-
function _toPropertyKey(
|
|
27
|
-
function _toPrimitive(
|
|
28
|
-
|
|
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 =
|
|
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(
|
|
39
|
+
var _applyEffect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(effect) {
|
|
45
40
|
var options,
|
|
46
41
|
effectFn,
|
|
47
|
-
_args = arguments
|
|
48
|
-
|
|
49
|
-
|
|
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:
|
|
54
|
-
engraving:
|
|
55
|
-
doming:
|
|
56
|
-
embroidery:
|
|
57
|
-
color_embossing:
|
|
49
|
+
embossing: embossingEffect,
|
|
50
|
+
engraving: engravingEffect,
|
|
51
|
+
doming: domingEffect,
|
|
52
|
+
embroidery: embroideryEffect,
|
|
53
|
+
color_embossing: colorEmbossingEffect
|
|
58
54
|
}[effect];
|
|
59
|
-
|
|
60
|
-
if (!
|
|
61
|
-
_context.
|
|
55
|
+
_t = effectFn;
|
|
56
|
+
if (!_t) {
|
|
57
|
+
_context.n = 2;
|
|
62
58
|
break;
|
|
63
59
|
}
|
|
64
|
-
_context.
|
|
60
|
+
_context.n = 1;
|
|
65
61
|
return effectFn(this.canvas, options);
|
|
66
|
-
case
|
|
67
|
-
|
|
68
|
-
case
|
|
69
|
-
return _context.
|
|
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
|
-
|
|
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++) {
|
package/React/ReactBase.js
CHANGED
|
@@ -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(
|
|
13
|
-
function _defineProperties(
|
|
14
|
-
function _createClass(
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function
|
|
26
|
-
function
|
|
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 =
|
|
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 =
|
|
41
|
-
_defineProperty(
|
|
42
|
-
_defineProperty(
|
|
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
|
-
|
|
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
|
-
|
|
60
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(Component, null), _container);
|
|
68
61
|
}
|
|
69
62
|
}, {
|
|
70
63
|
key: "dispose",
|
|
71
64
|
value: function dispose() {
|
|
72
|
-
|
|
65
|
+
_superPropGet(ReactBase, "dispose", this, 3)([]);
|
|
73
66
|
if (this._container) {
|
|
74
|
-
|
|
67
|
+
ReactDOM.unmountComponentAtNode(this._container);
|
|
75
68
|
}
|
|
76
69
|
}
|
|
77
70
|
}]);
|
|
78
|
-
|
|
79
|
-
}(_VisualizationInterface.VisualizationInterface);
|
|
71
|
+
}(VisualizationInterface);
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
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
|
|
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"
|