@configuratorware/configurator-frontendgui 1.57.1 → 1.57.3
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/App/Modules/Designer/Layouts/DefaultLayout.js +52 -27
- package/App/Screens/Configurator/Components/FullScreenView/index.js +3 -3
- package/App/Screens/Configurator/Components/PreviewPortal/index.js +11 -2
- package/App/Screens/Configurator/Containers/FullScreenView.js +0 -1
- package/App/Services/DesignDataService.js +220 -129
- package/package.json +4 -4
- package/src/App/Modules/Designer/Layouts/DefaultLayout.js +26 -8
- package/src/App/Screens/Configurator/Components/FullScreenView/index.js +3 -3
- package/src/App/Screens/Configurator/Components/PreviewPortal/index.js +10 -3
- package/src/App/Screens/Configurator/Containers/FullScreenView.js +0 -1
- package/src/App/Services/DesignDataService.js +56 -0
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports["default"] = void 0;
|
|
7
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _styles = require("@material-ui/core/styles");
|
|
9
10
|
var _withWidth = _interopRequireDefault(require("@material-ui/core/withWidth"));
|
|
10
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
+
var _ServiceLocator = require("../../../ServiceLocator");
|
|
14
|
+
var _DesignDataService = require("../../../Services/DesignDataService");
|
|
12
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
-
function
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
17
|
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; }
|
|
15
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
19
|
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); }
|
|
20
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
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; } }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
26
|
+
var usePreviewMode = function usePreviewMode() {
|
|
27
|
+
var _useState = (0, _react.useState)(function () {
|
|
28
|
+
return _ServiceLocator.Services.designData.getIsInPreviewMode();
|
|
29
|
+
}),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
isInPreviewMode = _useState2[0],
|
|
32
|
+
setIsInPreviewMode = _useState2[1];
|
|
33
|
+
(0, _react.useEffect)(function () {
|
|
34
|
+
return _ServiceLocator.Services.designData.observable.on(_DesignDataService.EventTypes.PreviewModeChange, function (_ref) {
|
|
35
|
+
var data = _ref.data;
|
|
36
|
+
setIsInPreviewMode(data.isInPreviewMode);
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
return isInPreviewMode;
|
|
40
|
+
};
|
|
17
41
|
var styles = function styles(theme) {
|
|
18
42
|
var _$main, _container, _designer;
|
|
19
43
|
return {
|
|
@@ -70,24 +94,24 @@ var styles = function styles(theme) {
|
|
|
70
94
|
pointerEvents: 'none' // important: don't remove this
|
|
71
95
|
},
|
|
72
96
|
|
|
73
|
-
sidebar: function sidebar(
|
|
74
|
-
var
|
|
75
|
-
var isPortraitMode =
|
|
76
|
-
return
|
|
97
|
+
sidebar: function sidebar(_ref2) {
|
|
98
|
+
var _ref3;
|
|
99
|
+
var isPortraitMode = _ref2.isPortraitMode;
|
|
100
|
+
return _ref3 = {
|
|
77
101
|
position: 'relative',
|
|
78
102
|
display: 'flex',
|
|
79
103
|
flexDirection: 'column',
|
|
80
104
|
marginTop: theme.spacing(1),
|
|
81
105
|
width: !isPortraitMode ? theme.layout.sidebar.width : ''
|
|
82
|
-
}, _defineProperty(
|
|
106
|
+
}, _defineProperty(_ref3, theme.breakpoints.up('sm'), {
|
|
83
107
|
marginTop: 0,
|
|
84
108
|
marginLeft: theme.spacing(1)
|
|
85
|
-
}), _defineProperty(
|
|
109
|
+
}), _defineProperty(_ref3, theme.breakpoints.down('xs'), {
|
|
86
110
|
maxWidth: 'none'
|
|
87
|
-
}), _defineProperty(
|
|
111
|
+
}), _defineProperty(_ref3, '& > *', {
|
|
88
112
|
// make the components in the sidebar overlap the visualization
|
|
89
113
|
zIndex: 1
|
|
90
|
-
}), _defineProperty(
|
|
114
|
+
}), _defineProperty(_ref3, "pointerEvents", 'none'), _ref3;
|
|
91
115
|
},
|
|
92
116
|
visualization: _defineProperty({
|
|
93
117
|
// the visualization is in the background with absolute positioning
|
|
@@ -134,22 +158,23 @@ var styles = function styles(theme) {
|
|
|
134
158
|
}
|
|
135
159
|
};
|
|
136
160
|
};
|
|
137
|
-
var DefaultLayout = function DefaultLayout(
|
|
138
|
-
var width =
|
|
139
|
-
classes =
|
|
140
|
-
renderHeader =
|
|
141
|
-
renderMain =
|
|
142
|
-
renderSidebar =
|
|
143
|
-
renderVisualization =
|
|
144
|
-
renderLoader =
|
|
145
|
-
renderLicenseNotice =
|
|
146
|
-
fallbackMode =
|
|
147
|
-
isPortraitMode =
|
|
148
|
-
imageOnly =
|
|
149
|
-
renderDesigner =
|
|
150
|
-
showDesigner =
|
|
151
|
-
visualizationOverlayMode =
|
|
152
|
-
renderInvalidConfigurationNotice =
|
|
161
|
+
var DefaultLayout = function DefaultLayout(_ref4) {
|
|
162
|
+
var width = _ref4.width,
|
|
163
|
+
classes = _ref4.classes,
|
|
164
|
+
renderHeader = _ref4.renderHeader,
|
|
165
|
+
renderMain = _ref4.renderMain,
|
|
166
|
+
renderSidebar = _ref4.renderSidebar,
|
|
167
|
+
renderVisualization = _ref4.renderVisualization,
|
|
168
|
+
renderLoader = _ref4.renderLoader,
|
|
169
|
+
renderLicenseNotice = _ref4.renderLicenseNotice,
|
|
170
|
+
fallbackMode = _ref4.fallbackMode,
|
|
171
|
+
isPortraitMode = _ref4.isPortraitMode,
|
|
172
|
+
imageOnly = _ref4.imageOnly,
|
|
173
|
+
renderDesigner = _ref4.renderDesigner,
|
|
174
|
+
showDesigner = _ref4.showDesigner,
|
|
175
|
+
visualizationOverlayMode = _ref4.visualizationOverlayMode,
|
|
176
|
+
renderInvalidConfigurationNotice = _ref4.renderInvalidConfigurationNotice;
|
|
177
|
+
var isInPreviewMode = usePreviewMode();
|
|
153
178
|
return imageOnly ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
154
179
|
className: "".concat(classes.root, " ").concat(fallbackMode ? classes.fallbackMode : '')
|
|
155
180
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -182,7 +207,7 @@ var DefaultLayout = function DefaultLayout(_ref3) {
|
|
|
182
207
|
area: 'main',
|
|
183
208
|
width: width,
|
|
184
209
|
classes: classes
|
|
185
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
210
|
+
})), !isInPreviewMode && /*#__PURE__*/_react["default"].createElement("div", {
|
|
186
211
|
className: classes.sidebar
|
|
187
212
|
}, renderSidebar({
|
|
188
213
|
area: 'sidebar',
|
|
@@ -150,7 +150,6 @@ var FullScreenView = /*#__PURE__*/function (_React$Component) {
|
|
|
150
150
|
value: function render() {
|
|
151
151
|
var previewOpen = this.state.previewOpen;
|
|
152
152
|
var _this$props = this.props,
|
|
153
|
-
hasItems = _this$props.hasItems,
|
|
154
153
|
classes = _this$props.classes,
|
|
155
154
|
children = _this$props.children,
|
|
156
155
|
showPreviewButton = _this$props.showPreviewButton,
|
|
@@ -161,7 +160,8 @@ var FullScreenView = /*#__PURE__*/function (_React$Component) {
|
|
|
161
160
|
ThumbnailComponent = _this$props.ThumbnailComponent,
|
|
162
161
|
thumbnailProps = _this$props.thumbnailProps,
|
|
163
162
|
thumbnailDotMode = _this$props.thumbnailDotMode,
|
|
164
|
-
renderButtonOnTop = _this$props.renderButtonOnTop
|
|
163
|
+
renderButtonOnTop = _this$props.renderButtonOnTop,
|
|
164
|
+
hasMoreItems = _this$props.hasMoreItems;
|
|
165
165
|
var topPreviewButton = renderTopPreviewButton(_objectSpread(_objectSpread({}, this.props), {}, {
|
|
166
166
|
onClick: this.openPreview
|
|
167
167
|
}));
|
|
@@ -169,7 +169,7 @@ var FullScreenView = /*#__PURE__*/function (_React$Component) {
|
|
|
169
169
|
closePreviewMode: this.closePreview,
|
|
170
170
|
thumbnailClick: this.handleViewChange,
|
|
171
171
|
previewOpen: previewOpen,
|
|
172
|
-
|
|
172
|
+
hasMoreItems: hasMoreItems,
|
|
173
173
|
dialogStyle: dialogStyle
|
|
174
174
|
}, children), topPreviewButton, !previewOpen && children, showDesignViewList ? /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
175
175
|
container: true,
|
|
@@ -62,6 +62,8 @@ var styles = function styles(theme) {
|
|
|
62
62
|
borderTop: '7px solid ' + theme.palette.primary.main
|
|
63
63
|
}),
|
|
64
64
|
visualizationWrapperThumbs: _defineProperty({
|
|
65
|
+
position: 'relative',
|
|
66
|
+
width: '100%',
|
|
65
67
|
height: 'calc(100% - 200px)'
|
|
66
68
|
}, theme.breakpoints.down('xs'), {
|
|
67
69
|
'& > div:first-child': {
|
|
@@ -70,7 +72,9 @@ var styles = function styles(theme) {
|
|
|
70
72
|
height: 'calc(100% - 130px)'
|
|
71
73
|
}),
|
|
72
74
|
visualizationWrapperCanvas: _defineProperty({
|
|
73
|
-
|
|
75
|
+
position: 'relative',
|
|
76
|
+
width: '100%',
|
|
77
|
+
height: '100%'
|
|
74
78
|
}, theme.breakpoints.up('sm'), {
|
|
75
79
|
height: 'calc(100% - 100px)'
|
|
76
80
|
}),
|
|
@@ -130,7 +134,12 @@ var PreviewPortal = /*#__PURE__*/function (_React$Component) {
|
|
|
130
134
|
_createClass(PreviewPortal, [{
|
|
131
135
|
key: "componentDidMount",
|
|
132
136
|
value: function componentDidMount() {
|
|
133
|
-
this
|
|
137
|
+
var _this2 = this;
|
|
138
|
+
requestAnimationFrame(function () {
|
|
139
|
+
if (_this2.wrapperRef.current) {
|
|
140
|
+
_this2.props.alignTarget.add(_this2.wrapperRef.current);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
134
143
|
}
|
|
135
144
|
}, {
|
|
136
145
|
key: "componentWillUnmount",
|
|
@@ -26,7 +26,6 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
26
26
|
_ServiceLocator.Services.visualization.initDesignAreaInteraction();
|
|
27
27
|
},
|
|
28
28
|
showDesignViewList: (0, _Selectors.getDesignViewLength)(state) > 1 && !(0, _Selectors2.isAnyDesignAreaSelected)(state),
|
|
29
|
-
hasItems: (0, _Selectors.getDesignViewLength)(state) > 0,
|
|
30
29
|
hasMoreItems: (0, _Selectors.getDesignViewLength)(state) > 1,
|
|
31
30
|
areAllDesignAreasEmpty: (0, _Selectors2.areAllDesignAreasEmpty)(state.configurator)
|
|
32
31
|
};
|
|
@@ -82,6 +82,23 @@ var preloadFonts = function preloadFonts(canvasData) {
|
|
|
82
82
|
return _FontFaceRepository.FontFaceRepository.collectFromHTML(content);
|
|
83
83
|
}));
|
|
84
84
|
};
|
|
85
|
+
|
|
86
|
+
// Replaces text node content inside a bulk name HTML string while preserving span styling
|
|
87
|
+
// (color, font-family, etc.) so screenshots render with the correct font and color.
|
|
88
|
+
var applyBulkNameToContent = function applyBulkNameToContent(htmlContent, name) {
|
|
89
|
+
var div = document.createElement('div');
|
|
90
|
+
div.innerHTML = htmlContent;
|
|
91
|
+
var walker = document.createTreeWalker(div, NodeFilter.SHOW_TEXT);
|
|
92
|
+
var first = true;
|
|
93
|
+
var node;
|
|
94
|
+
while (node = walker.nextNode()) {
|
|
95
|
+
if (node.textContent.trim()) {
|
|
96
|
+
node.textContent = first ? name : '';
|
|
97
|
+
first = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return div.innerHTML;
|
|
101
|
+
};
|
|
85
102
|
var checkColorUsage = exports.checkColorUsage = function () {
|
|
86
103
|
var alreadyAlertedColorCountState = {};
|
|
87
104
|
return function (canvasDataJSON, changeEvent) {
|
|
@@ -483,7 +500,8 @@ var updateColorAmountOnDesignProductionMethodChange = exports.updateColorAmountO
|
|
|
483
500
|
};
|
|
484
501
|
var EventTypes = exports.EventTypes = {
|
|
485
502
|
DesignAreaListChange: 'DesignDataService/DesignAreaListChange',
|
|
486
|
-
DesignViewListChange: 'DesignDataService/DesignViewListChange'
|
|
503
|
+
DesignViewListChange: 'DesignDataService/DesignViewListChange',
|
|
504
|
+
PreviewModeChange: 'DesignDataService/PreviewModeChange'
|
|
487
505
|
};
|
|
488
506
|
var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
489
507
|
function DesignDataService() {
|
|
@@ -2143,6 +2161,9 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2143
2161
|
key: "toggleIsInPreviewMode",
|
|
2144
2162
|
value: function toggleIsInPreviewMode(isInPreviewMode) {
|
|
2145
2163
|
this.isInPreviewMode = isInPreviewMode;
|
|
2164
|
+
this.observable.dispatch(EventTypes.PreviewModeChange, {
|
|
2165
|
+
isInPreviewMode: isInPreviewMode
|
|
2166
|
+
});
|
|
2146
2167
|
if (!this.isInPreviewMode) {
|
|
2147
2168
|
var hasSelectedDesignArea = !!(0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state).identifier;
|
|
2148
2169
|
if (hasSelectedDesignArea) {
|
|
@@ -2150,6 +2171,11 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2150
2171
|
}
|
|
2151
2172
|
}
|
|
2152
2173
|
}
|
|
2174
|
+
}, {
|
|
2175
|
+
key: "getIsInPreviewMode",
|
|
2176
|
+
value: function getIsInPreviewMode() {
|
|
2177
|
+
return this.isInPreviewMode;
|
|
2178
|
+
}
|
|
2153
2179
|
}, {
|
|
2154
2180
|
key: "createHighlightMemo",
|
|
2155
2181
|
value: function createHighlightMemo(tmpState) {
|
|
@@ -2261,6 +2287,71 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2261
2287
|
}
|
|
2262
2288
|
return getScreenshotsOfElements;
|
|
2263
2289
|
}()
|
|
2290
|
+
/**
|
|
2291
|
+
* Temporarily applies a bulk name to all isBulkName canvas objects, updates the visualization
|
|
2292
|
+
* texture, runs the provided callback (e.g. to take screenshots), then restores the originals.
|
|
2293
|
+
* Use this to generate one product render per bulk name without persisting the change.
|
|
2294
|
+
*/
|
|
2295
|
+
}, {
|
|
2296
|
+
key: "withBulkNameApplied",
|
|
2297
|
+
value: function () {
|
|
2298
|
+
var _withBulkNameApplied = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(bulkNameText, callback) {
|
|
2299
|
+
var _this1 = this;
|
|
2300
|
+
var restorations;
|
|
2301
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context27) {
|
|
2302
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2303
|
+
case 0:
|
|
2304
|
+
restorations = this.getDesignAreas().map(function (area) {
|
|
2305
|
+
return _this1._getCanvas(area);
|
|
2306
|
+
}).filter(Boolean).flatMap(function (canvas) {
|
|
2307
|
+
return (canvas.objects || []).filter(function (obj) {
|
|
2308
|
+
return obj.isBulkName;
|
|
2309
|
+
}).map(function (obj) {
|
|
2310
|
+
var original = obj.content;
|
|
2311
|
+
obj.content = applyBulkNameToContent(obj.content, bulkNameText);
|
|
2312
|
+
return function () {
|
|
2313
|
+
obj.content = original;
|
|
2314
|
+
};
|
|
2315
|
+
});
|
|
2316
|
+
});
|
|
2317
|
+
this.syncCanvasChange();
|
|
2318
|
+
_context27.next = 4;
|
|
2319
|
+
return this.updateVisualization({
|
|
2320
|
+
data: {
|
|
2321
|
+
screenshot: true
|
|
2322
|
+
}
|
|
2323
|
+
});
|
|
2324
|
+
case 4:
|
|
2325
|
+
_context27.prev = 4;
|
|
2326
|
+
_context27.next = 7;
|
|
2327
|
+
return callback();
|
|
2328
|
+
case 7:
|
|
2329
|
+
return _context27.abrupt("return", _context27.sent);
|
|
2330
|
+
case 8:
|
|
2331
|
+
_context27.prev = 8;
|
|
2332
|
+
restorations.forEach(function (restore) {
|
|
2333
|
+
return restore();
|
|
2334
|
+
});
|
|
2335
|
+
this.syncCanvasChange();
|
|
2336
|
+
_context27.next = 13;
|
|
2337
|
+
return this.updateVisualization({
|
|
2338
|
+
data: {
|
|
2339
|
+
screenshot: true
|
|
2340
|
+
}
|
|
2341
|
+
});
|
|
2342
|
+
case 13:
|
|
2343
|
+
return _context27.finish(8);
|
|
2344
|
+
case 14:
|
|
2345
|
+
case "end":
|
|
2346
|
+
return _context27.stop();
|
|
2347
|
+
}
|
|
2348
|
+
}, _callee26, this, [[4,, 8, 14]]);
|
|
2349
|
+
}));
|
|
2350
|
+
function withBulkNameApplied(_x27, _x28) {
|
|
2351
|
+
return _withBulkNameApplied.apply(this, arguments);
|
|
2352
|
+
}
|
|
2353
|
+
return withBulkNameApplied;
|
|
2354
|
+
}()
|
|
2264
2355
|
/**
|
|
2265
2356
|
* Provides a simple interface to add or remove sample text to the canvas related to the given designAreaIdentifier.
|
|
2266
2357
|
* It also provides a function to modify the color amount, it simply clears the canvas and re-adds the sample text
|
|
@@ -2274,7 +2365,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2274
2365
|
}, {
|
|
2275
2366
|
key: "getSampleCanvasEditorForDesignArea",
|
|
2276
2367
|
value: function getSampleCanvasEditorForDesignArea() {
|
|
2277
|
-
var
|
|
2368
|
+
var _this10 = this;
|
|
2278
2369
|
var designAreaIdentifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2279
2370
|
designAreaIdentifier && _ServiceLocator.Services.store.dispatch((0, _Actions3.selectDesignArea)(designAreaIdentifier));
|
|
2280
2371
|
var designArea = _ServiceLocator.Services.store.state.designArea.selectedDesignArea;
|
|
@@ -2308,20 +2399,20 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2308
2399
|
} else {
|
|
2309
2400
|
canvas.clear();
|
|
2310
2401
|
}
|
|
2311
|
-
|
|
2402
|
+
_this10.updateCanvasData(canvas);
|
|
2312
2403
|
},
|
|
2313
2404
|
setColorAmount: function setColorAmount(value) {
|
|
2314
2405
|
clearTextObjects();
|
|
2315
|
-
|
|
2406
|
+
_this10.setColorAmount(value);
|
|
2316
2407
|
previouslyContainedSampleText && addSampleText();
|
|
2317
2408
|
var imgObjects = canvas.objects.filter(function (obj) {
|
|
2318
2409
|
return obj.type !== 'Text';
|
|
2319
2410
|
});
|
|
2320
|
-
var canvasData =
|
|
2411
|
+
var canvasData = _this10._serializeCanvas(canvas);
|
|
2321
2412
|
if (imgObjects.length > 0) {
|
|
2322
|
-
canvasData =
|
|
2413
|
+
canvasData = _this10.calculateObjectPosition(canvas);
|
|
2323
2414
|
}
|
|
2324
|
-
|
|
2415
|
+
_this10.setCanvasData(canvasData, identifier);
|
|
2325
2416
|
}
|
|
2326
2417
|
};
|
|
2327
2418
|
}
|
|
@@ -2329,24 +2420,24 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2329
2420
|
}, {
|
|
2330
2421
|
key: "addSampleImageForDesignAreas",
|
|
2331
2422
|
value: function () {
|
|
2332
|
-
var _addSampleImageForDesignAreas = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2333
|
-
var
|
|
2334
|
-
return _regeneratorRuntime().wrap(function
|
|
2335
|
-
while (1) switch (
|
|
2423
|
+
var _addSampleImageForDesignAreas = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(designAreaIdentifiers, active) {
|
|
2424
|
+
var _this11 = this;
|
|
2425
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context29) {
|
|
2426
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2336
2427
|
case 0:
|
|
2337
|
-
|
|
2428
|
+
_context29.next = 2;
|
|
2338
2429
|
return Promise.all(designAreaIdentifiers.map( /*#__PURE__*/function () {
|
|
2339
|
-
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2430
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(designAreaIdentifier) {
|
|
2340
2431
|
var designArea, canvas, state, imageSrc, imageData, canvasDataJSON, designData, canvasData, objects;
|
|
2341
|
-
return _regeneratorRuntime().wrap(function
|
|
2342
|
-
while (1) switch (
|
|
2432
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context28) {
|
|
2433
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2343
2434
|
case 0:
|
|
2344
|
-
designArea =
|
|
2345
|
-
canvas =
|
|
2435
|
+
designArea = _this11.getDesignAreaByIdentifier(designAreaIdentifier);
|
|
2436
|
+
canvas = _this11._getCanvas(designArea);
|
|
2346
2437
|
state = _ServiceLocator.Services.store.state;
|
|
2347
2438
|
imageSrc = _designer_placeholder_logo["default"];
|
|
2348
2439
|
if (!active) {
|
|
2349
|
-
|
|
2440
|
+
_context28.next = 13;
|
|
2350
2441
|
break;
|
|
2351
2442
|
}
|
|
2352
2443
|
imageData = (0, _Modifiers2.createSVGImageData)({
|
|
@@ -2356,55 +2447,55 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2356
2447
|
isPlaceHolderImage: true,
|
|
2357
2448
|
galleryImage: false
|
|
2358
2449
|
});
|
|
2359
|
-
|
|
2450
|
+
_context28.next = 8;
|
|
2360
2451
|
return _ServiceLocator.Services.designer.addImageFromUrl(canvas, (0, _Selectors2.getPreviewUrlFromImageData)(imageData.preview), imageData, {
|
|
2361
2452
|
enlargeImage: true
|
|
2362
2453
|
});
|
|
2363
2454
|
case 8:
|
|
2364
|
-
canvasDataJSON =
|
|
2455
|
+
canvasDataJSON = _this11.calculateObjectPosition(canvas); // eslint-disable-next-line no-console
|
|
2365
2456
|
console.log("Sample image added to canvas: ".concat(designAreaIdentifier));
|
|
2366
|
-
|
|
2367
|
-
|
|
2457
|
+
_this11.setCanvasData(canvasDataJSON, designAreaIdentifier);
|
|
2458
|
+
_context28.next = 21;
|
|
2368
2459
|
break;
|
|
2369
2460
|
case 13:
|
|
2370
2461
|
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(state, designAreaIdentifier);
|
|
2371
2462
|
canvasData = designData.canvasData;
|
|
2372
2463
|
if (canvasData) {
|
|
2373
|
-
|
|
2464
|
+
_context28.next = 17;
|
|
2374
2465
|
break;
|
|
2375
2466
|
}
|
|
2376
|
-
return
|
|
2467
|
+
return _context28.abrupt("return");
|
|
2377
2468
|
case 17:
|
|
2378
2469
|
objects = canvasData ? canvasData.objects.filter(function (obj) {
|
|
2379
2470
|
return obj.type === 'Text';
|
|
2380
2471
|
}) : [];
|
|
2381
|
-
|
|
2472
|
+
_this11.setCanvasData(_objectSpread(_objectSpread({}, canvasData), {}, {
|
|
2382
2473
|
objects: objects
|
|
2383
2474
|
}), designAreaIdentifier);
|
|
2384
|
-
|
|
2385
|
-
return
|
|
2475
|
+
_context28.next = 21;
|
|
2476
|
+
return _this11.loadCanvasDataFromState([designArea]);
|
|
2386
2477
|
case 21:
|
|
2387
|
-
return
|
|
2478
|
+
return _context28.abrupt("return", {
|
|
2388
2479
|
canvas: canvas,
|
|
2389
2480
|
designAreaIdentifier: designAreaIdentifier
|
|
2390
2481
|
});
|
|
2391
2482
|
case 22:
|
|
2392
2483
|
case "end":
|
|
2393
|
-
return
|
|
2484
|
+
return _context28.stop();
|
|
2394
2485
|
}
|
|
2395
|
-
},
|
|
2486
|
+
}, _callee27);
|
|
2396
2487
|
}));
|
|
2397
|
-
return function (
|
|
2488
|
+
return function (_x31) {
|
|
2398
2489
|
return _ref25.apply(this, arguments);
|
|
2399
2490
|
};
|
|
2400
2491
|
}()));
|
|
2401
2492
|
case 2:
|
|
2402
2493
|
case "end":
|
|
2403
|
-
return
|
|
2494
|
+
return _context29.stop();
|
|
2404
2495
|
}
|
|
2405
|
-
},
|
|
2496
|
+
}, _callee28);
|
|
2406
2497
|
}));
|
|
2407
|
-
function addSampleImageForDesignAreas(
|
|
2498
|
+
function addSampleImageForDesignAreas(_x29, _x30) {
|
|
2408
2499
|
return _addSampleImageForDesignAreas.apply(this, arguments);
|
|
2409
2500
|
}
|
|
2410
2501
|
return addSampleImageForDesignAreas;
|
|
@@ -2412,33 +2503,33 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2412
2503
|
}, {
|
|
2413
2504
|
key: "addImageToDesignArea",
|
|
2414
2505
|
value: function () {
|
|
2415
|
-
var _addImageToDesignArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2506
|
+
var _addImageToDesignArea = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(designArea, imageData) {
|
|
2416
2507
|
var canvas;
|
|
2417
|
-
return _regeneratorRuntime().wrap(function
|
|
2418
|
-
while (1) switch (
|
|
2508
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context30) {
|
|
2509
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2419
2510
|
case 0:
|
|
2420
2511
|
canvas = this._getCanvas(designArea);
|
|
2421
2512
|
if (canvas) {
|
|
2422
|
-
|
|
2513
|
+
_context30.next = 3;
|
|
2423
2514
|
break;
|
|
2424
2515
|
}
|
|
2425
|
-
return
|
|
2516
|
+
return _context30.abrupt("return", false);
|
|
2426
2517
|
case 3:
|
|
2427
|
-
|
|
2518
|
+
_context30.next = 5;
|
|
2428
2519
|
return _ServiceLocator.Services.designer.addImageFromUrl(canvas, (0, _Selectors2.getPreviewUrlFromImageData)(imageData.preview), imageData, {
|
|
2429
2520
|
enlargeImage: true,
|
|
2430
2521
|
scaleToHalf: false,
|
|
2431
2522
|
autoSelect: false
|
|
2432
2523
|
});
|
|
2433
2524
|
case 5:
|
|
2434
|
-
return
|
|
2525
|
+
return _context30.abrupt("return", _context30.sent);
|
|
2435
2526
|
case 6:
|
|
2436
2527
|
case "end":
|
|
2437
|
-
return
|
|
2528
|
+
return _context30.stop();
|
|
2438
2529
|
}
|
|
2439
|
-
},
|
|
2530
|
+
}, _callee29, this);
|
|
2440
2531
|
}));
|
|
2441
|
-
function addImageToDesignArea(
|
|
2532
|
+
function addImageToDesignArea(_x32, _x33) {
|
|
2442
2533
|
return _addImageToDesignArea.apply(this, arguments);
|
|
2443
2534
|
}
|
|
2444
2535
|
return addImageToDesignArea;
|
|
@@ -2509,72 +2600,72 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2509
2600
|
}, {
|
|
2510
2601
|
key: "setImageAndTextColor",
|
|
2511
2602
|
value: function () {
|
|
2512
|
-
var _setImageAndTextColor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2603
|
+
var _setImageAndTextColor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(color) {
|
|
2513
2604
|
var designArea, designData, objects, hasmultipleObjects, canvas, isImageSelected, selectedImageIdentifier, _iterator10, _step10, object, image, operations;
|
|
2514
|
-
return _regeneratorRuntime().wrap(function
|
|
2515
|
-
while (1) switch (
|
|
2605
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context31) {
|
|
2606
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2516
2607
|
case 0:
|
|
2517
2608
|
if (this.changeAllColorsNeeded()) {
|
|
2518
|
-
|
|
2609
|
+
_context31.next = 2;
|
|
2519
2610
|
break;
|
|
2520
2611
|
}
|
|
2521
|
-
return
|
|
2612
|
+
return _context31.abrupt("return");
|
|
2522
2613
|
case 2:
|
|
2523
2614
|
designArea = (0, _Selectors.getSelectedDesignArea)(_ServiceLocator.Services.store.state);
|
|
2524
2615
|
designData = (0, _Selectors.getDesignDataByDesignAreaIdentifier)(_ServiceLocator.Services.store.state, designArea.identifier);
|
|
2525
2616
|
objects = (0, _get2["default"])(designData, 'canvasData.objects', []);
|
|
2526
2617
|
hasmultipleObjects = objects.length > 1;
|
|
2527
2618
|
if (hasmultipleObjects) {
|
|
2528
|
-
|
|
2619
|
+
_context31.next = 8;
|
|
2529
2620
|
break;
|
|
2530
2621
|
}
|
|
2531
|
-
return
|
|
2622
|
+
return _context31.abrupt("return");
|
|
2532
2623
|
case 8:
|
|
2533
2624
|
canvas = this._getCanvas(designArea);
|
|
2534
2625
|
isImageSelected = canvas.selectedObject && canvas.selectedObject.type === 'Image';
|
|
2535
2626
|
selectedImageIdentifier = isImageSelected ? (0, _get2["default"])(_ServiceLocator.Services.store.state, 'imageGallery.selectedImage.identifier', null) : null;
|
|
2536
2627
|
_ServiceLocator.Services.store.dispatch((0, _Actions.setDesignAreaTextsColor)(designArea.identifier, color));
|
|
2537
2628
|
_iterator10 = _createForOfIteratorHelper(objects);
|
|
2538
|
-
|
|
2629
|
+
_context31.prev = 13;
|
|
2539
2630
|
_iterator10.s();
|
|
2540
2631
|
case 15:
|
|
2541
2632
|
if ((_step10 = _iterator10.n()).done) {
|
|
2542
|
-
|
|
2633
|
+
_context31.next = 24;
|
|
2543
2634
|
break;
|
|
2544
2635
|
}
|
|
2545
2636
|
object = _step10.value;
|
|
2546
2637
|
if (!(object.type === 'Image' && object.imageData.identifier !== selectedImageIdentifier)) {
|
|
2547
|
-
|
|
2638
|
+
_context31.next = 22;
|
|
2548
2639
|
break;
|
|
2549
2640
|
}
|
|
2550
2641
|
image = (0, _Selectors2.getUserImage)(_ServiceLocator.Services.store.state, object.imageData.identifier);
|
|
2551
2642
|
operations = (0, _Modifiers.setColorOnOperations)(image.operations, color);
|
|
2552
|
-
|
|
2643
|
+
_context31.next = 22;
|
|
2553
2644
|
return _ServiceLocator.Services.designData.editFile(operations, image);
|
|
2554
2645
|
case 22:
|
|
2555
|
-
|
|
2646
|
+
_context31.next = 15;
|
|
2556
2647
|
break;
|
|
2557
2648
|
case 24:
|
|
2558
|
-
|
|
2649
|
+
_context31.next = 29;
|
|
2559
2650
|
break;
|
|
2560
2651
|
case 26:
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
_iterator10.e(
|
|
2652
|
+
_context31.prev = 26;
|
|
2653
|
+
_context31.t0 = _context31["catch"](13);
|
|
2654
|
+
_iterator10.e(_context31.t0);
|
|
2564
2655
|
case 29:
|
|
2565
|
-
|
|
2656
|
+
_context31.prev = 29;
|
|
2566
2657
|
_iterator10.f();
|
|
2567
|
-
return
|
|
2658
|
+
return _context31.finish(29);
|
|
2568
2659
|
case 32:
|
|
2569
|
-
|
|
2660
|
+
_context31.next = 34;
|
|
2570
2661
|
return this.updateCanvasDataFromState([designArea]);
|
|
2571
2662
|
case 34:
|
|
2572
2663
|
case "end":
|
|
2573
|
-
return
|
|
2664
|
+
return _context31.stop();
|
|
2574
2665
|
}
|
|
2575
|
-
},
|
|
2666
|
+
}, _callee30, this, [[13, 26, 29, 32]]);
|
|
2576
2667
|
}));
|
|
2577
|
-
function setImageAndTextColor(
|
|
2668
|
+
function setImageAndTextColor(_x34) {
|
|
2578
2669
|
return _setImageAndTextColor.apply(this, arguments);
|
|
2579
2670
|
}
|
|
2580
2671
|
return setImageAndTextColor;
|
|
@@ -2582,24 +2673,24 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2582
2673
|
}, {
|
|
2583
2674
|
key: "getGalleryImageColors",
|
|
2584
2675
|
value: function () {
|
|
2585
|
-
var _getGalleryImageColors = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2676
|
+
var _getGalleryImageColors = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(url) {
|
|
2586
2677
|
var svgContent, designProductionMethod;
|
|
2587
|
-
return _regeneratorRuntime().wrap(function
|
|
2588
|
-
while (1) switch (
|
|
2678
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context32) {
|
|
2679
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2589
2680
|
case 0:
|
|
2590
|
-
|
|
2681
|
+
_context32.next = 2;
|
|
2591
2682
|
return getSvgContent(url, url.startsWith('http'));
|
|
2592
2683
|
case 2:
|
|
2593
|
-
svgContent =
|
|
2684
|
+
svgContent = _context32.sent;
|
|
2594
2685
|
designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state);
|
|
2595
|
-
return
|
|
2686
|
+
return _context32.abrupt("return", (0, _Modifiers.createVectorizeColorsMap)({}, getSvgColors(svgContent, designProductionMethod)));
|
|
2596
2687
|
case 5:
|
|
2597
2688
|
case "end":
|
|
2598
|
-
return
|
|
2689
|
+
return _context32.stop();
|
|
2599
2690
|
}
|
|
2600
|
-
},
|
|
2691
|
+
}, _callee31);
|
|
2601
2692
|
}));
|
|
2602
|
-
function getGalleryImageColors(
|
|
2693
|
+
function getGalleryImageColors(_x35) {
|
|
2603
2694
|
return _getGalleryImageColors.apply(this, arguments);
|
|
2604
2695
|
}
|
|
2605
2696
|
return getGalleryImageColors;
|
|
@@ -2607,49 +2698,49 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2607
2698
|
}, {
|
|
2608
2699
|
key: "getSVGImageSize",
|
|
2609
2700
|
value: function () {
|
|
2610
|
-
var _getSVGImageSize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2701
|
+
var _getSVGImageSize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(url) {
|
|
2611
2702
|
var _svgContent$match, _svgContent$match2, _svgContent$match3, _svgTag$match;
|
|
2612
2703
|
var svgContent, svgTag, width, height, viewBoxValues;
|
|
2613
|
-
return _regeneratorRuntime().wrap(function
|
|
2614
|
-
while (1) switch (
|
|
2704
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context33) {
|
|
2705
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2615
2706
|
case 0:
|
|
2616
|
-
|
|
2707
|
+
_context33.next = 2;
|
|
2617
2708
|
return getSvgContent(url, url.startsWith('http'));
|
|
2618
2709
|
case 2:
|
|
2619
|
-
svgContent =
|
|
2710
|
+
svgContent = _context33.sent;
|
|
2620
2711
|
svgTag = (_svgContent$match = svgContent.match(/<svg[^>]+>/)) === null || _svgContent$match === void 0 ? void 0 : _svgContent$match[0];
|
|
2621
2712
|
width = (_svgContent$match2 = svgContent.match(/width="([^"]+)"/)) === null || _svgContent$match2 === void 0 ? void 0 : _svgContent$match2[1];
|
|
2622
2713
|
height = (_svgContent$match3 = svgContent.match(/height="([^"]+)"/)) === null || _svgContent$match3 === void 0 ? void 0 : _svgContent$match3[1];
|
|
2623
2714
|
if (!(width && height)) {
|
|
2624
|
-
|
|
2715
|
+
_context33.next = 8;
|
|
2625
2716
|
break;
|
|
2626
2717
|
}
|
|
2627
|
-
return
|
|
2718
|
+
return _context33.abrupt("return", {
|
|
2628
2719
|
width: parseFloat(width),
|
|
2629
2720
|
height: parseFloat(height)
|
|
2630
2721
|
});
|
|
2631
2722
|
case 8:
|
|
2632
2723
|
viewBoxValues = (_svgTag$match = svgTag.match(/viewBox="([^"]+)"/)) === null || _svgTag$match === void 0 || (_svgTag$match = _svgTag$match[1]) === null || _svgTag$match === void 0 ? void 0 : _svgTag$match.split(' ');
|
|
2633
2724
|
if (!(viewBoxValues.length === 4)) {
|
|
2634
|
-
|
|
2725
|
+
_context33.next = 11;
|
|
2635
2726
|
break;
|
|
2636
2727
|
}
|
|
2637
|
-
return
|
|
2728
|
+
return _context33.abrupt("return", {
|
|
2638
2729
|
width: parseFloat(viewBoxValues[2]),
|
|
2639
2730
|
height: parseFloat(viewBoxValues[3])
|
|
2640
2731
|
});
|
|
2641
2732
|
case 11:
|
|
2642
|
-
return
|
|
2733
|
+
return _context33.abrupt("return", {
|
|
2643
2734
|
width: 300,
|
|
2644
2735
|
height: 300
|
|
2645
2736
|
});
|
|
2646
2737
|
case 12:
|
|
2647
2738
|
case "end":
|
|
2648
|
-
return
|
|
2739
|
+
return _context33.stop();
|
|
2649
2740
|
}
|
|
2650
|
-
},
|
|
2741
|
+
}, _callee32);
|
|
2651
2742
|
}));
|
|
2652
|
-
function getSVGImageSize(
|
|
2743
|
+
function getSVGImageSize(_x36) {
|
|
2653
2744
|
return _getSVGImageSize.apply(this, arguments);
|
|
2654
2745
|
}
|
|
2655
2746
|
return getSVGImageSize;
|
|
@@ -2674,34 +2765,34 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2674
2765
|
}, {
|
|
2675
2766
|
key: "editFileQueued",
|
|
2676
2767
|
value: function () {
|
|
2677
|
-
var _editFileQueued = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2768
|
+
var _editFileQueued = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(operations, image) {
|
|
2678
2769
|
var options,
|
|
2679
2770
|
releaseLock,
|
|
2680
|
-
|
|
2681
|
-
return _regeneratorRuntime().wrap(function
|
|
2682
|
-
while (1) switch (
|
|
2771
|
+
_args34 = arguments;
|
|
2772
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context34) {
|
|
2773
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2683
2774
|
case 0:
|
|
2684
|
-
options =
|
|
2685
|
-
|
|
2775
|
+
options = _args34.length > 2 && _args34[2] !== undefined ? _args34[2] : {};
|
|
2776
|
+
_context34.next = 3;
|
|
2686
2777
|
return (0, _ObjectLock.requestLock)(this);
|
|
2687
2778
|
case 3:
|
|
2688
|
-
releaseLock =
|
|
2689
|
-
|
|
2690
|
-
|
|
2779
|
+
releaseLock = _context34.sent;
|
|
2780
|
+
_context34.prev = 4;
|
|
2781
|
+
_context34.next = 7;
|
|
2691
2782
|
return this.editFile(operations, image, options);
|
|
2692
2783
|
case 7:
|
|
2693
|
-
return
|
|
2784
|
+
return _context34.abrupt("return", _context34.sent);
|
|
2694
2785
|
case 8:
|
|
2695
|
-
|
|
2786
|
+
_context34.prev = 8;
|
|
2696
2787
|
releaseLock();
|
|
2697
|
-
return
|
|
2788
|
+
return _context34.finish(8);
|
|
2698
2789
|
case 11:
|
|
2699
2790
|
case "end":
|
|
2700
|
-
return
|
|
2791
|
+
return _context34.stop();
|
|
2701
2792
|
}
|
|
2702
|
-
},
|
|
2793
|
+
}, _callee33, this, [[4,, 8, 11]]);
|
|
2703
2794
|
}));
|
|
2704
|
-
function editFileQueued(
|
|
2795
|
+
function editFileQueued(_x37, _x38) {
|
|
2705
2796
|
return _editFileQueued.apply(this, arguments);
|
|
2706
2797
|
}
|
|
2707
2798
|
return editFileQueued;
|
|
@@ -2709,7 +2800,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2709
2800
|
}, {
|
|
2710
2801
|
key: "editFile",
|
|
2711
2802
|
value: function () {
|
|
2712
|
-
var _editFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2803
|
+
var _editFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(operations, image) {
|
|
2713
2804
|
var options,
|
|
2714
2805
|
_options$immediateCom,
|
|
2715
2806
|
immediateCommit,
|
|
@@ -2743,11 +2834,11 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2743
2834
|
vectorizeOriginalColorsMap,
|
|
2744
2835
|
numberOfAggregatedColors,
|
|
2745
2836
|
numberOfColorsToRemove,
|
|
2746
|
-
|
|
2747
|
-
return _regeneratorRuntime().wrap(function
|
|
2748
|
-
while (1) switch (
|
|
2837
|
+
_args35 = arguments;
|
|
2838
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context35) {
|
|
2839
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2749
2840
|
case 0:
|
|
2750
|
-
options =
|
|
2841
|
+
options = _args35.length > 2 && _args35[2] !== undefined ? _args35[2] : {};
|
|
2751
2842
|
// patch operations to keep other unchanged values
|
|
2752
2843
|
operations = _objectSpread(_objectSpread({}, image.operations), operations);
|
|
2753
2844
|
_options$immediateCom = options.immediateCommit, immediateCommit = _options$immediateCom === void 0 ? false : _options$immediateCom, _options$designProduc = options.designProductionMethod, designProductionMethod = _options$designProduc === void 0 ? (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state) : _options$designProduc, _options$addMode = options.addMode, addMode = _options$addMode === void 0 ? false : _options$addMode, displayColorPreview = options.displayColorPreview;
|
|
@@ -2766,7 +2857,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2766
2857
|
displayColorPreview: displayColorPreview
|
|
2767
2858
|
});
|
|
2768
2859
|
if (!(!operationsMatching || !imageIsCompatible)) {
|
|
2769
|
-
|
|
2860
|
+
_context35.next = 29;
|
|
2770
2861
|
break;
|
|
2771
2862
|
}
|
|
2772
2863
|
if (!image.operations) {
|
|
@@ -2774,13 +2865,13 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2774
2865
|
}
|
|
2775
2866
|
operations = makeOperationsCompatible(operations, compatibilityInfoHash, designProductionMethod.colorPalettes);
|
|
2776
2867
|
if (!image.gallery) {
|
|
2777
|
-
|
|
2868
|
+
_context35.next = 18;
|
|
2778
2869
|
break;
|
|
2779
2870
|
}
|
|
2780
2871
|
operations = _objectSpread(_objectSpread({}, operations || {}), {}, {
|
|
2781
2872
|
vectorizeColorsMap: operations.vectorizeColorsMap
|
|
2782
2873
|
});
|
|
2783
|
-
|
|
2874
|
+
_context35.next = 29;
|
|
2784
2875
|
break;
|
|
2785
2876
|
case 18:
|
|
2786
2877
|
_getImageUsageInfo = (0, _Selectors2.getImageUsageInfo)(_ServiceLocator.Services.store.state, image.identifier), designAreas = _getImageUsageInfo.designAreas, count = _getImageUsageInfo.count;
|
|
@@ -2789,10 +2880,10 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2789
2880
|
currentEditData = (0, _Modifiers.getEditDataFromOperations)(image.fileName, image.operations || {}, designProductionMethod);
|
|
2790
2881
|
isBackendNeeded = createCopy || !(0, _isEqual["default"])(editData, currentEditData);
|
|
2791
2882
|
if (!isBackendNeeded) {
|
|
2792
|
-
|
|
2883
|
+
_context35.next = 29;
|
|
2793
2884
|
break;
|
|
2794
2885
|
}
|
|
2795
|
-
|
|
2886
|
+
_context35.next = 26;
|
|
2796
2887
|
return _ServiceLocator.Services.store.dispatch((0, _Actions2.editImage)(_objectSpread(_objectSpread({}, editData), {}, {
|
|
2797
2888
|
createCopy: createCopy
|
|
2798
2889
|
}), _objectSpread(_objectSpread({}, imageDataPatch), {}, {
|
|
@@ -2808,20 +2899,20 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2808
2899
|
imageIdentifier = (0, _get2["default"])(selectedImage, 'identifier');
|
|
2809
2900
|
case 29:
|
|
2810
2901
|
if (!(!preview || !preview.url)) {
|
|
2811
|
-
|
|
2902
|
+
_context35.next = 31;
|
|
2812
2903
|
break;
|
|
2813
2904
|
}
|
|
2814
2905
|
throw new Error('Preview image url is not specified!');
|
|
2815
2906
|
case 31:
|
|
2816
2907
|
if (!(0, _Selectors2.isEditableVectorImage)(preview)) {
|
|
2817
|
-
|
|
2908
|
+
_context35.next = 40;
|
|
2818
2909
|
break;
|
|
2819
2910
|
}
|
|
2820
2911
|
_designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(_ServiceLocator.Services.store.state);
|
|
2821
|
-
|
|
2912
|
+
_context35.next = 35;
|
|
2822
2913
|
return getSvgContent(preview.url, preview.url.startsWith('http'), !operationsMatching);
|
|
2823
2914
|
case 35:
|
|
2824
|
-
svgContent =
|
|
2915
|
+
svgContent = _context35.sent;
|
|
2825
2916
|
svgColors = getSvgColors(svgContent, _designProductionMethod);
|
|
2826
2917
|
vectorizeColorsMap = (0, _Modifiers.createVectorizeColorsMap)(operations.vectorizeColorsMap, svgColors);
|
|
2827
2918
|
thresholdChanged = operations.vectorizeThreshold !== (0, _get2["default"])(image, 'operations.vectorizeThreshold', 0); // prepare initial values for the vectorize feature
|
|
@@ -2859,7 +2950,7 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2859
2950
|
if (immediateCommit) {
|
|
2860
2951
|
this.updateDesignAreaImagesWithSelectedImageData(image.identifier);
|
|
2861
2952
|
}
|
|
2862
|
-
return
|
|
2953
|
+
return _context35.abrupt("return", {
|
|
2863
2954
|
vectorizeColorsMap: operations.vectorizeColorsMap,
|
|
2864
2955
|
vectorizeThreshold: operations.vectorizeThreshold,
|
|
2865
2956
|
vectorizeMaxColorAmount: operations.vectorizeMaxColorAmount,
|
|
@@ -2867,11 +2958,11 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2867
2958
|
});
|
|
2868
2959
|
case 43:
|
|
2869
2960
|
case "end":
|
|
2870
|
-
return
|
|
2961
|
+
return _context35.stop();
|
|
2871
2962
|
}
|
|
2872
|
-
},
|
|
2963
|
+
}, _callee34, this);
|
|
2873
2964
|
}));
|
|
2874
|
-
function editFile(
|
|
2965
|
+
function editFile(_x39, _x40) {
|
|
2875
2966
|
return _editFile.apply(this, arguments);
|
|
2876
2967
|
}
|
|
2877
2968
|
return editFile;
|
|
@@ -2879,10 +2970,10 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2879
2970
|
}, {
|
|
2880
2971
|
key: "resetEditedFile",
|
|
2881
2972
|
value: function () {
|
|
2882
|
-
var _resetEditedFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2973
|
+
var _resetEditedFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(image) {
|
|
2883
2974
|
var state, _image, operations, vectorizeColorsMap, resetOperations, designProductionMethod;
|
|
2884
|
-
return _regeneratorRuntime().wrap(function
|
|
2885
|
-
while (1) switch (
|
|
2975
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context36) {
|
|
2976
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2886
2977
|
case 0:
|
|
2887
2978
|
state = _ServiceLocator.Services.store.state;
|
|
2888
2979
|
if (!image) {
|
|
@@ -2901,17 +2992,17 @@ var DesignDataService = exports["default"] = /*#__PURE__*/function () {
|
|
|
2901
2992
|
vectorizeThreshold: null
|
|
2902
2993
|
});
|
|
2903
2994
|
}
|
|
2904
|
-
|
|
2995
|
+
_context36.next = 7;
|
|
2905
2996
|
return this.editFileQueued(resetOperations, image);
|
|
2906
2997
|
case 7:
|
|
2907
|
-
return
|
|
2998
|
+
return _context36.abrupt("return", _context36.sent);
|
|
2908
2999
|
case 8:
|
|
2909
3000
|
case "end":
|
|
2910
|
-
return
|
|
3001
|
+
return _context36.stop();
|
|
2911
3002
|
}
|
|
2912
|
-
},
|
|
3003
|
+
}, _callee35, this);
|
|
2913
3004
|
}));
|
|
2914
|
-
function resetEditedFile(
|
|
3005
|
+
function resetEditedFile(_x41) {
|
|
2915
3006
|
return _resetEditedFile.apply(this, arguments);
|
|
2916
3007
|
}
|
|
2917
3008
|
return resetEditedFile;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.57.
|
|
3
|
+
"version": "1.57.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/polyfill": "^7.12.1",
|
|
9
|
-
"@configuratorware/scripts": "1.57.
|
|
9
|
+
"@configuratorware/scripts": "1.57.3",
|
|
10
10
|
"@material-ui/core": "^4.12.4",
|
|
11
11
|
"@material-ui/icons": "^4.11.3",
|
|
12
12
|
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"react-router-dom": "^5.3.4",
|
|
37
37
|
"react-swipeable": "^5.5.1",
|
|
38
38
|
"react-zoom-pan-pinch": "^2.1.3",
|
|
39
|
-
"redhotmagma-graphics-editor": "1.57.
|
|
40
|
-
"redhotmagma-visualization": "1.57.
|
|
39
|
+
"redhotmagma-graphics-editor": "1.57.3",
|
|
40
|
+
"redhotmagma-visualization": "1.57.3",
|
|
41
41
|
"redux": "^4.1.0",
|
|
42
42
|
"redux-logger": "^3.0.6",
|
|
43
43
|
"redux-persist": "^5.10.0",
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { withStyles } from '@material-ui/core/styles';
|
|
3
3
|
import withWidth from '@material-ui/core/withWidth';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { Services } from 'App/ServiceLocator';
|
|
7
|
+
import { EventTypes as DesignDataEventTypes } from 'App/Services/DesignDataService';
|
|
8
|
+
|
|
9
|
+
const usePreviewMode = () => {
|
|
10
|
+
const [isInPreviewMode, setIsInPreviewMode] = useState(() => Services.designData.getIsInPreviewMode());
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
return Services.designData.observable.on(DesignDataEventTypes.PreviewModeChange, ({ data }) => {
|
|
14
|
+
setIsInPreviewMode(data.isInPreviewMode);
|
|
15
|
+
});
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
return isInPreviewMode;
|
|
19
|
+
};
|
|
6
20
|
|
|
7
21
|
const styles = theme => ({
|
|
8
22
|
root: {
|
|
@@ -155,6 +169,8 @@ const DefaultLayout = ({
|
|
|
155
169
|
visualizationOverlayMode,
|
|
156
170
|
renderInvalidConfigurationNotice,
|
|
157
171
|
}) => {
|
|
172
|
+
const isInPreviewMode = usePreviewMode();
|
|
173
|
+
|
|
158
174
|
return imageOnly ? (
|
|
159
175
|
<div className={`${classes.root} ${fallbackMode ? classes.fallbackMode : ''}`}>
|
|
160
176
|
<div className={`${classes.container} ${isPortraitMode ? classes.containerTabletPortrait : ''}`}>
|
|
@@ -199,13 +215,15 @@ const DefaultLayout = ({
|
|
|
199
215
|
classes,
|
|
200
216
|
})}
|
|
201
217
|
</div>
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
218
|
+
{!isInPreviewMode && (
|
|
219
|
+
<div className={classes.sidebar}>
|
|
220
|
+
{renderSidebar({
|
|
221
|
+
area: 'sidebar',
|
|
222
|
+
width,
|
|
223
|
+
classes,
|
|
224
|
+
})}
|
|
225
|
+
</div>
|
|
226
|
+
)}
|
|
209
227
|
</div>
|
|
210
228
|
{renderLoader()}
|
|
211
229
|
</div>
|
|
@@ -104,7 +104,7 @@ class FullScreenView extends React.Component {
|
|
|
104
104
|
static propTypes = {
|
|
105
105
|
handleOpenPreview: PropTypes.func,
|
|
106
106
|
handleClosePreview: PropTypes.func,
|
|
107
|
-
|
|
107
|
+
hasMoreItems: PropTypes.bool,
|
|
108
108
|
classes: PropTypes.object,
|
|
109
109
|
children: PropTypes.any,
|
|
110
110
|
showPreviewButton: PropTypes.bool,
|
|
@@ -142,7 +142,6 @@ class FullScreenView extends React.Component {
|
|
|
142
142
|
render() {
|
|
143
143
|
const { previewOpen } = this.state;
|
|
144
144
|
const {
|
|
145
|
-
hasItems,
|
|
146
145
|
classes,
|
|
147
146
|
children,
|
|
148
147
|
showPreviewButton,
|
|
@@ -154,6 +153,7 @@ class FullScreenView extends React.Component {
|
|
|
154
153
|
thumbnailProps,
|
|
155
154
|
thumbnailDotMode,
|
|
156
155
|
renderButtonOnTop,
|
|
156
|
+
hasMoreItems,
|
|
157
157
|
} = this.props;
|
|
158
158
|
|
|
159
159
|
const topPreviewButton = renderTopPreviewButton({
|
|
@@ -168,7 +168,7 @@ class FullScreenView extends React.Component {
|
|
|
168
168
|
closePreviewMode={this.closePreview}
|
|
169
169
|
thumbnailClick={this.handleViewChange}
|
|
170
170
|
previewOpen={previewOpen}
|
|
171
|
-
|
|
171
|
+
hasMoreItems={hasMoreItems}
|
|
172
172
|
dialogStyle={dialogStyle}
|
|
173
173
|
>
|
|
174
174
|
{children}
|
|
@@ -44,6 +44,8 @@ const styles = theme => ({
|
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
visualizationWrapperThumbs: {
|
|
47
|
+
position: 'relative',
|
|
48
|
+
width: '100%',
|
|
47
49
|
height: 'calc(100% - 200px)',
|
|
48
50
|
[theme.breakpoints.down('xs')]: {
|
|
49
51
|
'& > div:first-child': {
|
|
@@ -53,7 +55,9 @@ const styles = theme => ({
|
|
|
53
55
|
},
|
|
54
56
|
},
|
|
55
57
|
visualizationWrapperCanvas: {
|
|
56
|
-
|
|
58
|
+
position: 'relative',
|
|
59
|
+
width: '100%',
|
|
60
|
+
height: '100%',
|
|
57
61
|
[theme.breakpoints.up('sm')]: {
|
|
58
62
|
height: 'calc(100% - 100px)',
|
|
59
63
|
},
|
|
@@ -100,7 +104,6 @@ class PreviewPortal extends React.Component {
|
|
|
100
104
|
classes: PropTypes.object,
|
|
101
105
|
width: PropTypes.string,
|
|
102
106
|
dialogStyle: PropTypes.string,
|
|
103
|
-
hasItems: PropTypes.bool,
|
|
104
107
|
hasMoreItems: PropTypes.bool,
|
|
105
108
|
alignTarget: PropTypes.shape({ add: PropTypes.func.isRequired, remove: PropTypes.func.isRequired })
|
|
106
109
|
.isRequired,
|
|
@@ -108,7 +111,11 @@ class PreviewPortal extends React.Component {
|
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
componentDidMount() {
|
|
111
|
-
|
|
114
|
+
requestAnimationFrame(() => {
|
|
115
|
+
if (this.wrapperRef.current) {
|
|
116
|
+
this.props.alignTarget.add(this.wrapperRef.current);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
componentWillUnmount() {
|
|
@@ -20,7 +20,6 @@ const mapStateToProps = state => {
|
|
|
20
20
|
Services.visualization.initDesignAreaInteraction();
|
|
21
21
|
},
|
|
22
22
|
showDesignViewList: getDesignViewLength(state) > 1 && !isAnyDesignAreaSelected(state),
|
|
23
|
-
hasItems: getDesignViewLength(state) > 0,
|
|
24
23
|
hasMoreItems: getDesignViewLength(state) > 1,
|
|
25
24
|
areAllDesignAreasEmpty: areAllDesignAreasEmpty(state.configurator),
|
|
26
25
|
};
|
|
@@ -134,6 +134,23 @@ const preloadFonts = canvasData =>
|
|
|
134
134
|
.map(({ content }) => FontFaceRepository.collectFromHTML(content))
|
|
135
135
|
);
|
|
136
136
|
|
|
137
|
+
// Replaces text node content inside a bulk name HTML string while preserving span styling
|
|
138
|
+
// (color, font-family, etc.) so screenshots render with the correct font and color.
|
|
139
|
+
const applyBulkNameToContent = (htmlContent, name) => {
|
|
140
|
+
const div = document.createElement('div');
|
|
141
|
+
div.innerHTML = htmlContent;
|
|
142
|
+
const walker = document.createTreeWalker(div, NodeFilter.SHOW_TEXT);
|
|
143
|
+
let first = true;
|
|
144
|
+
let node;
|
|
145
|
+
while ((node = walker.nextNode())) {
|
|
146
|
+
if (node.textContent.trim()) {
|
|
147
|
+
node.textContent = first ? name : '';
|
|
148
|
+
first = false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return div.innerHTML;
|
|
152
|
+
};
|
|
153
|
+
|
|
137
154
|
export const checkColorUsage = (() => {
|
|
138
155
|
let alreadyAlertedColorCountState = {};
|
|
139
156
|
return (canvasDataJSON, changeEvent) => {
|
|
@@ -560,6 +577,7 @@ export const updateColorAmountOnDesignProductionMethodChange = selectedDesignPro
|
|
|
560
577
|
export const EventTypes = {
|
|
561
578
|
DesignAreaListChange: 'DesignDataService/DesignAreaListChange',
|
|
562
579
|
DesignViewListChange: 'DesignDataService/DesignViewListChange',
|
|
580
|
+
PreviewModeChange: 'DesignDataService/PreviewModeChange',
|
|
563
581
|
};
|
|
564
582
|
|
|
565
583
|
export default class DesignDataService {
|
|
@@ -1708,6 +1726,7 @@ export default class DesignDataService {
|
|
|
1708
1726
|
|
|
1709
1727
|
toggleIsInPreviewMode(isInPreviewMode) {
|
|
1710
1728
|
this.isInPreviewMode = isInPreviewMode;
|
|
1729
|
+
this.observable.dispatch(EventTypes.PreviewModeChange, { isInPreviewMode });
|
|
1711
1730
|
|
|
1712
1731
|
if (!this.isInPreviewMode) {
|
|
1713
1732
|
const hasSelectedDesignArea = !!getSelectedDesignArea(Services.store.state).identifier;
|
|
@@ -1718,6 +1737,10 @@ export default class DesignDataService {
|
|
|
1718
1737
|
}
|
|
1719
1738
|
}
|
|
1720
1739
|
|
|
1740
|
+
getIsInPreviewMode() {
|
|
1741
|
+
return this.isInPreviewMode;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1721
1744
|
createHighlightMemo(tmpState) {
|
|
1722
1745
|
const origState = isHighlighted(Services.store.state);
|
|
1723
1746
|
this.toggleHighlight(tmpState, false);
|
|
@@ -1756,6 +1779,39 @@ export default class DesignDataService {
|
|
|
1756
1779
|
return await this.getScreenshots(fontMapping, { screenshotFn: 'getScreenshotsOfElements' });
|
|
1757
1780
|
}
|
|
1758
1781
|
|
|
1782
|
+
/**
|
|
1783
|
+
* Temporarily applies a bulk name to all isBulkName canvas objects, updates the visualization
|
|
1784
|
+
* texture, runs the provided callback (e.g. to take screenshots), then restores the originals.
|
|
1785
|
+
* Use this to generate one product render per bulk name without persisting the change.
|
|
1786
|
+
*/
|
|
1787
|
+
async withBulkNameApplied(bulkNameText, callback) {
|
|
1788
|
+
const restorations = this.getDesignAreas()
|
|
1789
|
+
.map(area => this._getCanvas(area))
|
|
1790
|
+
.filter(Boolean)
|
|
1791
|
+
.flatMap(canvas =>
|
|
1792
|
+
(canvas.objects || [])
|
|
1793
|
+
.filter(obj => obj.isBulkName)
|
|
1794
|
+
.map(obj => {
|
|
1795
|
+
const original = obj.content;
|
|
1796
|
+
obj.content = applyBulkNameToContent(obj.content, bulkNameText);
|
|
1797
|
+
return () => {
|
|
1798
|
+
obj.content = original;
|
|
1799
|
+
};
|
|
1800
|
+
})
|
|
1801
|
+
);
|
|
1802
|
+
|
|
1803
|
+
this.syncCanvasChange();
|
|
1804
|
+
await this.updateVisualization({ data: { screenshot: true } });
|
|
1805
|
+
|
|
1806
|
+
try {
|
|
1807
|
+
return await callback();
|
|
1808
|
+
} finally {
|
|
1809
|
+
restorations.forEach(restore => restore());
|
|
1810
|
+
this.syncCanvasChange();
|
|
1811
|
+
await this.updateVisualization({ data: { screenshot: true } });
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1759
1815
|
/**
|
|
1760
1816
|
* Provides a simple interface to add or remove sample text to the canvas related to the given designAreaIdentifier.
|
|
1761
1817
|
* It also provides a function to modify the color amount, it simply clears the canvas and re-adds the sample text
|