redhotmagma-visualization 1.28.0-beta.2 → 1.28.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 (96) hide show
  1. package/README.md +4 -11
  2. package/babel.config.js +41 -0
  3. package/package.json +72 -6
  4. package/public/libs/draco/README.md +32 -0
  5. package/public/libs/draco/draco_decoder.js +52 -0
  6. package/public/libs/draco/draco_decoder.wasm +0 -0
  7. package/public/libs/draco/draco_encoder.js +33 -0
  8. package/public/libs/draco/draco_wasm_wrapper.js +104 -0
  9. package/public/libs/draco/gltf/draco_decoder.js +48 -0
  10. package/public/libs/draco/gltf/draco_decoder.wasm +0 -0
  11. package/public/libs/draco/gltf/draco_encoder.js +33 -0
  12. package/public/libs/draco/gltf/draco_wasm_wrapper.js +104 -0
  13. package/scripts/cpPath.js +151 -0
  14. package/scripts/cpPublic.js +39 -0
  15. package/scripts/moveLibToPackageRoot.js +44 -0
  16. package/scripts/utils/fileSystem.js +69 -0
  17. package/scripts/utils/process.js +19 -0
  18. package/src/CommonUtils/Observable.js +0 -1
  19. package/src/CommonUtils/pointerEvent.js +1 -2
  20. package/src/DevApp.js +1 -2
  21. package/src/FallbackVisualization.js +5 -1
  22. package/src/PrintingEffects/DomingEffect.js +0 -1
  23. package/src/PrintingEffects/EmbroideryEffect.js +2 -3
  24. package/src/React/ReactBase.js +1 -1
  25. package/src/Three/Controls/OrbitControls.js +0 -2
  26. package/src/Three/Loaders/ColladaLoader.js +294 -111
  27. package/src/Three/Loaders/MTLLoader.js +0 -2
  28. package/src/Three/Loaders/OBJLoader.js +0 -2
  29. package/src/Three/Three2D.js +6 -7
  30. package/src/Three/Three3D.js +1 -9
  31. package/src/Three/ThreeBase.js +1 -10
  32. package/src/Utils/DesignArea/getDesignAreaCanvasSize.js +0 -1
  33. package/src/Utils/TextureBuilder/createTextureBuilder.js +0 -2
  34. package/src/Utils/imagePreloader.js +0 -1
  35. package/src/Utils/initTextureCanvas.js +0 -3
  36. package/src/Utils/isMobileDevice.js +0 -2
  37. package/src/Utils/optimizeTextureImage.js +0 -1
  38. package/src/VisualizationContainer.js +1 -3
  39. package/src/VisualizationInterface.js +1 -10
  40. package/tsconfig.json +22 -0
  41. package/AlignTargetProvider.js +0 -129
  42. package/CommonUtils/Deferred.js +0 -135
  43. package/CommonUtils/Observable.js +0 -126
  44. package/CommonUtils/PropertyObserver.js +0 -61
  45. package/CommonUtils/SyncCurrentFunction.js +0 -59
  46. package/CommonUtils/SyncObservableEvent.js +0 -19
  47. package/CommonUtils/pointerEvent.js +0 -415
  48. package/Constants.js +0 -23
  49. package/DevApp.js +0 -1049
  50. package/ExposedModules.js +0 -26
  51. package/FallbackVisualization.js +0 -26
  52. package/PrintingEffects/ColorEmbossingEffect.js +0 -58
  53. package/PrintingEffects/DomingEffect.js +0 -150
  54. package/PrintingEffects/EmbossingEffect.js +0 -65
  55. package/PrintingEffects/EmbroideryEffect.js +0 -541
  56. package/PrintingEffects/EngravingEffect.js +0 -65
  57. package/PrintingEffects/PrintingEffects.js +0 -117
  58. package/PrintingEffects/PrintingEffectsUtils.js +0 -53
  59. package/PrintingEffects/resources/embroidery_multiply.jpg +0 -0
  60. package/PrintingEffects/resources/embroidery_screen.jpg +0 -0
  61. package/React/ReactBase.js +0 -111
  62. package/Three/Controls/OrbitControls.js +0 -745
  63. package/Three/Exporters/glTFExporter.js +0 -48
  64. package/Three/Loaders/ColladaLoader.js +0 -2916
  65. package/Three/Loaders/MTLLoader.js +0 -449
  66. package/Three/Loaders/OBJLoader.js +0 -548
  67. package/Three/Three2D.js +0 -1778
  68. package/Three/Three2DLayers.js +0 -504
  69. package/Three/Three3D.js +0 -1412
  70. package/Three/Three3DScene.js +0 -1432
  71. package/Three/ThreeBase.js +0 -722
  72. package/Utils/DesignArea/getDesignAreaCanvasSize.js +0 -32
  73. package/Utils/TextureBuilder/createTextureBuilder.js +0 -334
  74. package/Utils/TextureBuilder/textureBuilderFunctions.js +0 -87
  75. package/Utils/alignToElement.js +0 -58
  76. package/Utils/createAlphaMapFromAlphaChannel.js +0 -50
  77. package/Utils/createCache.js +0 -46
  78. package/Utils/createCanvas.js +0 -29
  79. package/Utils/createImageRepository.js +0 -124
  80. package/Utils/disposeMaterial.js +0 -41
  81. package/Utils/getImageSize.js +0 -15
  82. package/Utils/imagePreloader.js +0 -76
  83. package/Utils/initTextureCanvas.js +0 -49
  84. package/Utils/isMobileDevice.js +0 -19
  85. package/Utils/optimizeTextureImage.js +0 -73
  86. package/Utils/rememberCameraViewOffset.js +0 -21
  87. package/Utils/removeObject.js +0 -22
  88. package/Utils/restrictCameraMovement.js +0 -45
  89. package/Utils/setOrthographicCameraSize.js +0 -16
  90. package/Utils/updateFitSizeToElement.js +0 -39
  91. package/VisualizationContainer.js +0 -279
  92. package/VisualizationInterface.js +0 -293
  93. package/VisualizationProvider.js +0 -38
  94. package/__mocks__/exportedSample.svg +0 -45
  95. package/index.js +0 -16
  96. package/visualizationAdapterCreator.js +0 -76
@@ -1,117 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EffectCanvas = void 0;
7
-
8
- var _EmbossingEffect = require("./EmbossingEffect");
9
-
10
- var _EngravingEffect = require("./EngravingEffect");
11
-
12
- var _DomingEffect = require("./DomingEffect");
13
-
14
- var _EmbroideryEffect = require("./EmbroideryEffect");
15
-
16
- var _createCanvas = require("../Utils/createCanvas");
17
-
18
- var _ColorEmbossingEffect = require("./ColorEmbossingEffect");
19
-
20
- 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); } }
21
-
22
- 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); }); }; }
23
-
24
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
-
26
- 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."); }
27
-
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); }
29
-
30
- 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; }
31
-
32
- 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; }
33
-
34
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
-
36
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
-
38
- 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, descriptor.key, descriptor); } }
39
-
40
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
41
-
42
- var EffectCanvas = /*#__PURE__*/function () {
43
- function EffectCanvas(width, height) {
44
- _classCallCheck(this, EffectCanvas);
45
-
46
- var _createWorkingCanvas = (0, _createCanvas.createWorkingCanvas)({
47
- width: width,
48
- height: height
49
- }),
50
- _createWorkingCanvas2 = _slicedToArray(_createWorkingCanvas, 2),
51
- canvas = _createWorkingCanvas2[0],
52
- ctx = _createWorkingCanvas2[1];
53
-
54
- this.canvas = canvas;
55
- this.ctx = ctx;
56
- }
57
-
58
- _createClass(EffectCanvas, [{
59
- key: "applyEffect",
60
- value: function () {
61
- var _applyEffect = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(effect) {
62
- var options,
63
- effectFn,
64
- _args = arguments;
65
- return regeneratorRuntime.wrap(function _callee$(_context) {
66
- while (1) {
67
- switch (_context.prev = _context.next) {
68
- case 0:
69
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
70
- effectFn = {
71
- embossing: _EmbossingEffect.embossingEffect,
72
- engraving: _EngravingEffect.engravingEffect,
73
- doming: _DomingEffect.domingEffect,
74
- embroidery: _EmbroideryEffect.embroideryEffect,
75
- color_embossing: _ColorEmbossingEffect.colorEmbossingEffect
76
- }[effect];
77
- _context.t0 = effectFn;
78
-
79
- if (!_context.t0) {
80
- _context.next = 7;
81
- break;
82
- }
83
-
84
- _context.next = 6;
85
- return effectFn(this.canvas, options);
86
-
87
- case 6:
88
- _context.t0 = _context.sent;
89
-
90
- case 7:
91
- return _context.abrupt("return", _context.t0);
92
-
93
- case 8:
94
- case "end":
95
- return _context.stop();
96
- }
97
- }
98
- }, _callee, this);
99
- }));
100
-
101
- function applyEffect(_x) {
102
- return _applyEffect.apply(this, arguments);
103
- }
104
-
105
- return applyEffect;
106
- }()
107
- }, {
108
- key: "drawOn",
109
- value: function drawOn(ctx) {
110
- ctx.drawImage(this.canvas, 0, 0);
111
- }
112
- }]);
113
-
114
- return EffectCanvas;
115
- }();
116
-
117
- exports.EffectCanvas = EffectCanvas;
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getNewCanvas = getNewCanvas;
7
- exports.createBackgroundCanvas = createBackgroundCanvas;
8
- exports.createNegativeCanvas = createNegativeCanvas;
9
- exports.createShadowCanvas = createShadowCanvas;
10
-
11
- function getNewCanvas(width, height) {
12
- var canvas = document.createElement("canvas");
13
- canvas.width = width;
14
- canvas.height = height;
15
- return canvas;
16
- }
17
-
18
- function createBackgroundCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight) {
19
- var backgroundCanvas = getNewCanvas(canvasWidth, canvasHeight);
20
- var backgroundContext = backgroundCanvas.getContext("2d");
21
- backgroundContext.drawImage(baseCanvas, 0, 0);
22
- backgroundContext.globalCompositeOperation = "source-in";
23
- backgroundContext.fillStyle = fillColor;
24
- backgroundContext.fillRect(0, 0, canvasWidth, canvasHeight);
25
- return backgroundCanvas;
26
- }
27
-
28
- function createNegativeCanvas(baseCanvas, fillColor, canvasWidth, canvasHeight) {
29
- var negativeCanvas = getNewCanvas(canvasWidth, canvasHeight);
30
- var negativeContext = negativeCanvas.getContext("2d");
31
- negativeContext.fillStyle = fillColor;
32
- negativeContext.fillRect(0, 0, canvasWidth, canvasHeight);
33
- negativeContext.globalCompositeOperation = "destination-out";
34
- negativeContext.drawImage(baseCanvas, 0, 0);
35
- return negativeCanvas;
36
- }
37
-
38
- function createShadowCanvas(baseCanvas, shadows, canvasWidth, canvasHeight) {
39
- var shadowCanvas = getNewCanvas(canvasWidth, canvasHeight);
40
- var shadowContext = shadowCanvas.getContext("2d");
41
-
42
- for (var i = 0; i < shadows.length; i++) {
43
- shadowContext.shadowOffsetX = shadows[i].offsetX;
44
- shadowContext.shadowOffsetY = shadows[i].offsetY;
45
- shadowContext.shadowColor = shadows[i].color;
46
- shadowContext.shadowBlur = shadows[i].blur;
47
- shadowContext.drawImage(baseCanvas, 0, 0);
48
- }
49
-
50
- shadowContext.globalCompositeOperation = "destination-out";
51
- shadowContext.drawImage(baseCanvas, 0, 0);
52
- return shadowCanvas;
53
- }
@@ -1,111 +0,0 @@
1
- "use strict";
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
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.ReactBase = void 0;
9
-
10
- var _reactDom = _interopRequireDefault(require("react-dom"));
11
-
12
- var _react = _interopRequireDefault(require("react"));
13
-
14
- var _VisualizationInterface = require("../VisualizationInterface");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
-
20
- 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, descriptor.key, descriptor); } }
21
-
22
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23
-
24
- function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
25
-
26
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
27
-
28
- 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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
29
-
30
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
31
-
32
- 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); }; }
33
-
34
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
35
-
36
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
37
-
38
- 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; } }
39
-
40
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
-
42
- 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; }
43
-
44
- var NoComponent = function NoComponent() {
45
- return null;
46
- };
47
- /**
48
- * A base class for React based visualizations which renders the given Component in the container element
49
- */
50
-
51
-
52
- var ReactBase = /*#__PURE__*/function (_VisualizationInterfa) {
53
- _inherits(ReactBase, _VisualizationInterfa);
54
-
55
- var _super = _createSuper(ReactBase);
56
-
57
- function ReactBase(cfg) {
58
- var _this;
59
-
60
- _classCallCheck(this, ReactBase);
61
-
62
- _this = _super.call(this, cfg);
63
-
64
- _defineProperty(_assertThisInitialized(_this), "_container", null);
65
-
66
- _defineProperty(_assertThisInitialized(_this), "Component", NoComponent);
67
-
68
- if (cfg.Component) {
69
- _this.Component = cfg.Component;
70
- }
71
-
72
- return _this;
73
- }
74
-
75
- _createClass(ReactBase, [{
76
- key: "init",
77
- value: function init() {
78
- var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.createElement("div");
79
- this._isInitialized = true;
80
- this._container = container;
81
- this.render();
82
- }
83
- }, {
84
- key: "addToContainer",
85
- value: function addToContainer(container) {
86
- this._container = container;
87
- this.render();
88
- }
89
- }, {
90
- key: "render",
91
- value: function render() {
92
- var Component = this.Component,
93
- _container = this._container;
94
-
95
- _reactDom["default"].render( /*#__PURE__*/_react["default"].createElement(Component, null), _container);
96
- }
97
- }, {
98
- key: "dispose",
99
- value: function dispose() {
100
- _get(_getPrototypeOf(ReactBase.prototype), "dispose", this).call(this);
101
-
102
- if (this._container) {
103
- _reactDom["default"].unmountComponentAtNode(this._container);
104
- }
105
- }
106
- }]);
107
-
108
- return ReactBase;
109
- }(_VisualizationInterface.VisualizationInterface);
110
-
111
- exports.ReactBase = ReactBase;