@configuratorware/configurator-frontendgui 1.40.4 → 1.40.6
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/Containers/ImageEditDialog.js +10 -28
- package/App/Reducers/DesignArea/Selectors.js +11 -44
- package/App/Reducers/DesignData/Modifiers.js +1 -3
- package/App/Reducers/ImageGallery/Actions.js +18 -25
- package/App/Reducers/ImageGallery/Reducer.js +0 -5
- package/App/Reducers/ImageGallery/Selectors.js +1 -1
- package/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +9 -10
- package/App/Services/DesignDataService.js +435 -494
- package/App/configuration.js +1 -1
- package/package.json +4 -4
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +6 -33
- package/src/App/Reducers/DesignArea/Selectors.js +9 -39
- package/src/App/Reducers/DesignArea/__tests__/Selectors.test.js +0 -19
- package/src/App/Reducers/DesignData/Modifiers.js +0 -3
- package/src/App/Reducers/ImageGallery/Actions.js +5 -20
- package/src/App/Reducers/ImageGallery/Reducer.js +0 -5
- package/src/App/Reducers/ImageGallery/Selectors.js +3 -4
- package/src/App/Reducers/ImageGallery/__tests__/Actions.test.js +7 -81
- package/src/App/Screens/DesignerProductPreview/DesignerProductPreviewManager.js +1 -4
- package/src/App/Services/DesignDataService.js +16 -56
- package/src/App/configuration.js +1 -1
|
@@ -555,7 +555,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
555
555
|
isSvg = previewUrl && /\.svg$/.test(previewUrl);
|
|
556
556
|
|
|
557
557
|
if (!image) {
|
|
558
|
-
_context6.next =
|
|
558
|
+
_context6.next = 23;
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
561
|
|
|
@@ -579,7 +579,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
579
579
|
|
|
580
580
|
case 16:
|
|
581
581
|
preview = (0, _DesignDataService.applySvgContentOperations)(image.preview, image.displayColorPreview ? image.operations : null, svgContent);
|
|
582
|
-
_context6.next =
|
|
582
|
+
_context6.next = 23;
|
|
583
583
|
break;
|
|
584
584
|
|
|
585
585
|
case 19:
|
|
@@ -589,12 +589,10 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
589
589
|
_this.previewVersion = Math.random();
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
originalImagePreview = preview;
|
|
595
|
-
}
|
|
592
|
+
preview = (0, _Selectors3.getPreviewUrlFromImageData)(previewUrl) + (_this.previewVersion ? "?".concat(_this.previewVersion) : '');
|
|
593
|
+
originalImagePreview = preview;
|
|
596
594
|
|
|
597
|
-
case
|
|
595
|
+
case 23:
|
|
598
596
|
_this.lastImageUpdateData = image;
|
|
599
597
|
|
|
600
598
|
_this.setState({
|
|
@@ -602,7 +600,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
602
600
|
originalImagePreview: originalImagePreview
|
|
603
601
|
});
|
|
604
602
|
|
|
605
|
-
case
|
|
603
|
+
case 25:
|
|
606
604
|
case "end":
|
|
607
605
|
return _context6.stop();
|
|
608
606
|
}
|
|
@@ -832,8 +830,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
832
830
|
hasPlaceHolderImage = _this$props4.hasPlaceHolderImage,
|
|
833
831
|
isImageCompatible = _this$props4.isImageCompatible,
|
|
834
832
|
isColorMappingCompatible = _this$props4.isColorMappingCompatible,
|
|
835
|
-
vectorsRequired = _this$props4.vectorsRequired
|
|
836
|
-
vectorizedLogoMandatory = _this$props4.vectorizedLogoMandatory;
|
|
833
|
+
vectorsRequired = _this$props4.vectorsRequired;
|
|
837
834
|
var _this$state2 = this.state,
|
|
838
835
|
vectorize = _this$state2.vectorize,
|
|
839
836
|
vectorizeColorsMap = _this$state2.vectorizeColorsMap,
|
|
@@ -889,24 +886,13 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
889
886
|
});
|
|
890
887
|
}
|
|
891
888
|
|
|
892
|
-
if (activeTabIndex === 2 &&
|
|
889
|
+
if (activeTabIndex === 2 && vectorsRequired && !vectorize && !image.gallery) {
|
|
893
890
|
Object.assign(newState, {
|
|
894
891
|
vectorize: true
|
|
895
892
|
});
|
|
896
893
|
}
|
|
897
894
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
if (activeTabIndex === 2 && !image.gallery && vectorizedLogoMandatory && !image.displayColorPreview && !this.state.displayColorPreview) {
|
|
901
|
-
options = {
|
|
902
|
-
displayColorPreview: true
|
|
903
|
-
};
|
|
904
|
-
Object.assign(newState, {
|
|
905
|
-
displayColorPreview: true
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
(!(0, _isMatch["default"])(this.state, newState) || options) && this.handleStateChange(newState, options);
|
|
895
|
+
!(0, _isMatch["default"])(this.state, newState) && this.handleStateChange(newState);
|
|
910
896
|
|
|
911
897
|
if ((justOpened || imageChanged) && !image.incomplete) {
|
|
912
898
|
this.updatePreview(null, {
|
|
@@ -947,7 +933,6 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
947
933
|
maxColorAmount = _this$props6.maxColorAmount,
|
|
948
934
|
colorDisabled = _this$props6.colorDisabled,
|
|
949
935
|
vectorsRequired = _this$props6.vectorsRequired,
|
|
950
|
-
vectorizedLogoMandatory = _this$props6.vectorizedLogoMandatory,
|
|
951
936
|
image = _this$props6.image,
|
|
952
937
|
usedColors = _this$props6.usedColors,
|
|
953
938
|
imageColorsWereEdited = _this$props6.imageColorsWereEdited,
|
|
@@ -977,7 +962,7 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
977
962
|
return i + 1;
|
|
978
963
|
});
|
|
979
964
|
var colorCount = (0, _size["default"])(aggregatedColors);
|
|
980
|
-
var colorPreviewBlockActive = activeTabIndex === 2 && colorCount > 0 && !isGalleryImage &&
|
|
965
|
+
var colorPreviewBlockActive = activeTabIndex === 2 && colorCount > 0 && !isGalleryImage && (colorPreviewEnabled || !colorPreviewRequirementFulfilled);
|
|
981
966
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_ImageEditDialog["default"], _extends({}, this.props, {
|
|
982
967
|
loaderComponent: /*#__PURE__*/_react["default"].createElement(ProgressComponent, {
|
|
983
968
|
loading: loading
|
|
@@ -1065,7 +1050,6 @@ _defineProperty(ImageEditDialogContainer, "propTypes", {
|
|
|
1065
1050
|
open: _propTypes["default"].bool,
|
|
1066
1051
|
editMode: _propTypes["default"].bool,
|
|
1067
1052
|
vectorsRequired: _propTypes["default"].bool,
|
|
1068
|
-
vectorizedLogoMandatory: _propTypes["default"].bool,
|
|
1069
1053
|
colorDisabled: _propTypes["default"].bool,
|
|
1070
1054
|
loading: _propTypes["default"].bool,
|
|
1071
1055
|
errorCode: _propTypes["default"].string,
|
|
@@ -1123,7 +1107,6 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
1123
1107
|
var colorPalettes = (0, _Selectors.getColorPalettes)(state);
|
|
1124
1108
|
var designProductionMethod = (0, _Selectors.getSelectedDesignProductionMethod)(state);
|
|
1125
1109
|
var vectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1126
|
-
var vectorizedLogoMandatory = !!(0, _get["default"])(designProductionMethod, 'options.vectorizedLogoMandatory');
|
|
1127
1110
|
var colorDisabled = (0, _Selectors.isColoringDisabled)(state);
|
|
1128
1111
|
var userImages = getUserImages(imageGallery);
|
|
1129
1112
|
var hasPlaceHolderImage = (0, _Selectors.hasPlaceHolderImagesForActiveDesignArea)(state);
|
|
@@ -1161,7 +1144,6 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
1161
1144
|
userImages: userImages,
|
|
1162
1145
|
colorPalettes: colorPalettes,
|
|
1163
1146
|
vectorsRequired: vectorsRequired,
|
|
1164
|
-
vectorizedLogoMandatory: vectorizedLogoMandatory,
|
|
1165
1147
|
colorDisabled: colorDisabled,
|
|
1166
1148
|
uploadSize: uploadSize,
|
|
1167
1149
|
galleryHasImages: galleryHasImages,
|
|
@@ -76,9 +76,7 @@ var _exportNames = {
|
|
|
76
76
|
hasLastEditedDesignArea: true,
|
|
77
77
|
getDesignAreaPreSelection: true,
|
|
78
78
|
getDesignAreaColorAmount: true,
|
|
79
|
-
isVectorizedLogoMandatory: true,
|
|
80
79
|
getVectorizeForDesignProductionMethods: true,
|
|
81
|
-
getMandatoryVectorizationForDesignProductionMethods: true,
|
|
82
80
|
getImagesByDesignArea: true,
|
|
83
81
|
isOneLineText: true
|
|
84
82
|
};
|
|
@@ -127,7 +125,7 @@ exports.getColorsFromCanvasData = getColorsFromCanvasData;
|
|
|
127
125
|
exports.getColorsFromCanvasDataWithPalette = getColorsFromCanvasDataWithPalette;
|
|
128
126
|
exports.findSmallestFontSizeInCanvasData = findSmallestFontSizeInCanvasData;
|
|
129
127
|
exports.isOneLineText = isOneLineText;
|
|
130
|
-
exports.getImagesByDesignArea = exports.
|
|
128
|
+
exports.getImagesByDesignArea = exports.getVectorizeForDesignProductionMethods = exports.getDesignAreaColorAmount = exports.getDesignAreaPreSelection = exports.hasLastEditedDesignArea = exports.areAllDesignAreasEmpty = exports.getVectorizedImageColor = exports.areHashesCompatible = exports.getCurrentCompatibilityInfoHash = exports.getDesignAreaImageCompatibilityInfo = exports.contentHasText = exports.isPlaceholderContent = exports.getDefaultTextColor = exports.getDefaultColorsFromDesignProductionMethod = exports.getDefaultDesignAreaIdentifierFromProductionMethod = exports.getDesignAreaFromSelectedDesignView = exports.getDesignViewListForDesignAreas = exports.getCameraViewListForDesignAreaList = exports.parseColorData = exports.createColorData = exports.rgbObjToHex = exports.rgbString2hex = exports.rgbToHex = exports.calculateColorDistance = exports.hexToRgbNumbers = exports.hexToRgb = exports.isValidHex = exports.getColorPalettes = exports.hasPlaceHolderImagesForActiveDesignArea = exports.getDesignAreaIdentifierToOpen = void 0;
|
|
131
129
|
|
|
132
130
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
133
131
|
|
|
@@ -159,8 +157,6 @@ var _values = _interopRequireDefault(require("lodash/values"));
|
|
|
159
157
|
|
|
160
158
|
var _createSelector = _interopRequireDefault(require("../../../Utils/Function/createSelector"));
|
|
161
159
|
|
|
162
|
-
var _memoize = _interopRequireDefault(require("../../../Utils/Function/memoize"));
|
|
163
|
-
|
|
164
160
|
var _configuration = require("../../configuration");
|
|
165
161
|
|
|
166
162
|
var _DesignDataService = require("../../Services/DesignDataService");
|
|
@@ -621,15 +617,6 @@ function getCurrentCanvasSize(state) {
|
|
|
621
617
|
return getCanvasSizeFromDesignProductionMethod(designProductionMethod);
|
|
622
618
|
}
|
|
623
619
|
|
|
624
|
-
var memoizedCanvasSize = (0, _memoize["default"])(function (width, height, isMetric, dpi) {
|
|
625
|
-
return {
|
|
626
|
-
width: width,
|
|
627
|
-
height: height,
|
|
628
|
-
isMetric: isMetric,
|
|
629
|
-
dpi: dpi
|
|
630
|
-
};
|
|
631
|
-
});
|
|
632
|
-
|
|
633
620
|
function getCanvasSizeFromDesignProductionMethod(designProductionMethod) {
|
|
634
621
|
var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : zeroSize;
|
|
635
622
|
var width = designProductionMethod.width,
|
|
@@ -640,7 +627,12 @@ function getCanvasSizeFromDesignProductionMethod(designProductionMethod) {
|
|
|
640
627
|
return defaultSize;
|
|
641
628
|
}
|
|
642
629
|
|
|
643
|
-
return
|
|
630
|
+
return {
|
|
631
|
+
width: width,
|
|
632
|
+
height: height,
|
|
633
|
+
isMetric: true,
|
|
634
|
+
dpi: dpi || (0, _configuration.getConf)('designer.dpi', 300)
|
|
635
|
+
};
|
|
644
636
|
}
|
|
645
637
|
|
|
646
638
|
function getCanvasSizeFromDesignArea(state, designArea) {
|
|
@@ -1176,12 +1168,10 @@ var getDesignAreaImageCompatibilityInfo = function getDesignAreaImageCompatibili
|
|
|
1176
1168
|
}).sort();
|
|
1177
1169
|
var vectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1178
1170
|
var maxColorAmount = (0, _get["default"])(designProductionMethod, 'options.maxColorAmount', 0);
|
|
1179
|
-
var vectorizedLogoMandatory = (0, _get["default"])(designProductionMethod, 'options.vectorizedLogoMandatory', false);
|
|
1180
1171
|
return {
|
|
1181
1172
|
colorPalettes: colorPalettes,
|
|
1182
1173
|
vectorsRequired: vectorsRequired,
|
|
1183
|
-
maxColorAmount: maxColorAmount
|
|
1184
|
-
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
1174
|
+
maxColorAmount: maxColorAmount
|
|
1185
1175
|
};
|
|
1186
1176
|
};
|
|
1187
1177
|
|
|
@@ -1194,7 +1184,7 @@ var getCurrentCompatibilityInfoHash = function getCurrentCompatibilityInfoHash(s
|
|
|
1194
1184
|
exports.getCurrentCompatibilityInfoHash = getCurrentCompatibilityInfoHash;
|
|
1195
1185
|
|
|
1196
1186
|
var areHashesCompatible = function areHashesCompatible(storedHash, targetHash) {
|
|
1197
|
-
return Boolean(!targetHash || storedHash && (0, _isEqual["default"])(storedHash.colorPalettes, targetHash.colorPalettes) && (!targetHash.vectorsRequired || storedHash.vectorsRequired) && (!targetHash.
|
|
1187
|
+
return Boolean(!targetHash || storedHash && (0, _isEqual["default"])(storedHash.colorPalettes, targetHash.colorPalettes) && (!targetHash.vectorsRequired || storedHash.vectorsRequired) && (!targetHash.maxColorAmount || storedHash.maxColorAmount <= targetHash.maxColorAmount));
|
|
1198
1188
|
};
|
|
1199
1189
|
|
|
1200
1190
|
exports.areHashesCompatible = areHashesCompatible;
|
|
@@ -1300,21 +1290,13 @@ var getDesignAreaColorAmount = function getDesignAreaColorAmount(maxColorAmount,
|
|
|
1300
1290
|
|
|
1301
1291
|
exports.getDesignAreaColorAmount = getDesignAreaColorAmount;
|
|
1302
1292
|
|
|
1303
|
-
var isVectorizedLogoMandatory = function isVectorizedLogoMandatory(designProductionMethod) {
|
|
1304
|
-
var _designProductionMeth;
|
|
1305
|
-
|
|
1306
|
-
return !!(designProductionMethod !== null && designProductionMethod !== void 0 && (_designProductionMeth = designProductionMethod.options) !== null && _designProductionMeth !== void 0 && _designProductionMeth.vectorizedLogoMandatory);
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
|
-
exports.isVectorizedLogoMandatory = isVectorizedLogoMandatory;
|
|
1310
|
-
|
|
1311
1293
|
var getVectorizeForDesignProductionMethods = function getVectorizeForDesignProductionMethods(state, designProductionMethodIdentifier) {
|
|
1312
1294
|
var _getSelectedDesignAre3 = getSelectedDesignAreaProperties(state),
|
|
1313
1295
|
designProductionMethod = _getSelectedDesignAre3.designProductionMethod;
|
|
1314
1296
|
|
|
1315
1297
|
var newProductionMethod = getDesignProductionMethodByIdentifier(state, designProductionMethodIdentifier);
|
|
1316
|
-
var currentVectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired')
|
|
1317
|
-
var newVectorsRequired = !!(0, _get["default"])(newProductionMethod, 'options.vectorsRequired')
|
|
1298
|
+
var currentVectorsRequired = !!(0, _get["default"])(designProductionMethod, 'options.vectorsRequired');
|
|
1299
|
+
var newVectorsRequired = !!(0, _get["default"])(newProductionMethod, 'options.vectorsRequired');
|
|
1318
1300
|
return {
|
|
1319
1301
|
currentVectorsRequired: currentVectorsRequired,
|
|
1320
1302
|
newVectorsRequired: newVectorsRequired
|
|
@@ -1323,21 +1305,6 @@ var getVectorizeForDesignProductionMethods = function getVectorizeForDesignProdu
|
|
|
1323
1305
|
|
|
1324
1306
|
exports.getVectorizeForDesignProductionMethods = getVectorizeForDesignProductionMethods;
|
|
1325
1307
|
|
|
1326
|
-
var getMandatoryVectorizationForDesignProductionMethods = function getMandatoryVectorizationForDesignProductionMethods(state, designProductionMethodIdentifier) {
|
|
1327
|
-
var _getSelectedDesignAre4 = getSelectedDesignAreaProperties(state),
|
|
1328
|
-
designProductionMethod = _getSelectedDesignAre4.designProductionMethod;
|
|
1329
|
-
|
|
1330
|
-
var newProductionMethod = getDesignProductionMethodByIdentifier(state, designProductionMethodIdentifier);
|
|
1331
|
-
var currentVectorsMandatory = isVectorizedLogoMandatory(designProductionMethod);
|
|
1332
|
-
var newVectorsMandatory = isVectorizedLogoMandatory(newProductionMethod);
|
|
1333
|
-
return {
|
|
1334
|
-
currentVectorsMandatory: currentVectorsMandatory,
|
|
1335
|
-
newVectorsMandatory: newVectorsMandatory
|
|
1336
|
-
};
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
exports.getMandatoryVectorizationForDesignProductionMethods = getMandatoryVectorizationForDesignProductionMethods;
|
|
1340
|
-
|
|
1341
1308
|
var getImagesByDesignArea = function getImagesByDesignArea(state, designAreaIdentifier) {
|
|
1342
1309
|
if (!designAreaIdentifier) {
|
|
1343
1310
|
designAreaIdentifier = getSelectedDesignArea(state).identifier;
|
|
@@ -87,12 +87,10 @@ var getEditDataFromOperations = function getEditDataFromOperations(imageFileName
|
|
|
87
87
|
_operations$vectorize2 = operations.vectorizeThreshold,
|
|
88
88
|
vectorizeThreshold = _operations$vectorize2 === void 0 ? null : _operations$vectorize2;
|
|
89
89
|
var maxColorAmount = +(0, _get["default"])(designProductionMethod, 'options.maxColorAmount', 0);
|
|
90
|
-
var vectorizedLogoMandatory = (0, _get["default"])(designProductionMethod, 'options.vectorizedLogoMandatory', false);
|
|
91
90
|
var vectorizeMonochrome = maxColorAmount === 1 && vectorizeThreshold === 1;
|
|
92
91
|
var result = {
|
|
93
92
|
fileName: imageFileName,
|
|
94
|
-
operations: []
|
|
95
|
-
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
93
|
+
operations: []
|
|
96
94
|
};
|
|
97
95
|
|
|
98
96
|
if (clipping && clippingColor) {
|
|
@@ -169,34 +169,30 @@ exports.updateImage = updateImage;
|
|
|
169
169
|
|
|
170
170
|
var uploadImage = function uploadImage(file) {
|
|
171
171
|
return (0, _Actions2.createAsyncTask)(WN_UPLOAD_IMAGE, /*#__PURE__*/function () {
|
|
172
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch
|
|
173
|
-
var
|
|
172
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch) {
|
|
173
|
+
var data, uploadResponse;
|
|
174
174
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
175
175
|
while (1) {
|
|
176
176
|
switch (_context.prev = _context.next) {
|
|
177
177
|
case 0:
|
|
178
|
-
designProductionMethod = (0, _Selectors2.getSelectedDesignProductionMethod)(getState());
|
|
179
|
-
vectorizedLogoMandatory = (0, _Selectors2.isVectorizedLogoMandatory)(designProductionMethod);
|
|
180
178
|
data = new FormData();
|
|
181
179
|
data.append('userImage', file);
|
|
182
180
|
data.append('userImageEditData', JSON.stringify({}));
|
|
183
181
|
dispatch(dismissError());
|
|
184
|
-
_context.next =
|
|
185
|
-
return dispatch((0, _Actions.postDataAsync)(URL_UPLOAD, data, (0, _Actions.createDefaultReceiver)(RECEIVE_IMAGE_UPLOAD_DATA, {
|
|
186
|
-
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
187
|
-
}), {}, {}, {
|
|
182
|
+
_context.next = 6;
|
|
183
|
+
return dispatch((0, _Actions.postDataAsync)(URL_UPLOAD, data, (0, _Actions.createDefaultReceiver)(RECEIVE_IMAGE_UPLOAD_DATA), {}, {}, {
|
|
188
184
|
useLocalErrorHandling: true
|
|
189
185
|
}));
|
|
190
186
|
|
|
191
|
-
case
|
|
187
|
+
case 6:
|
|
192
188
|
uploadResponse = _context.sent;
|
|
193
|
-
_context.next =
|
|
189
|
+
_context.next = 9;
|
|
194
190
|
return (0, _DesignDataService.calculateImageBrightness)(uploadResponse);
|
|
195
191
|
|
|
196
|
-
case
|
|
192
|
+
case 9:
|
|
197
193
|
return _context.abrupt("return", _context.sent);
|
|
198
194
|
|
|
199
|
-
case
|
|
195
|
+
case 10:
|
|
200
196
|
case "end":
|
|
201
197
|
return _context.stop();
|
|
202
198
|
}
|
|
@@ -204,7 +200,7 @@ var uploadImage = function uploadImage(file) {
|
|
|
204
200
|
}, _callee);
|
|
205
201
|
}));
|
|
206
202
|
|
|
207
|
-
return function (_x
|
|
203
|
+
return function (_x) {
|
|
208
204
|
return _ref.apply(this, arguments);
|
|
209
205
|
};
|
|
210
206
|
}());
|
|
@@ -251,34 +247,31 @@ exports.dismissError = dismissError;
|
|
|
251
247
|
var editImage = function editImage(editData, imageData) {
|
|
252
248
|
var actionOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
253
249
|
return (0, _Actions2.createAsyncTask)(WN_UPLOAD_IMAGE, /*#__PURE__*/function () {
|
|
254
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch
|
|
255
|
-
var
|
|
250
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch) {
|
|
251
|
+
var data, createCopy, uploadResponse;
|
|
256
252
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
257
253
|
while (1) {
|
|
258
254
|
switch (_context2.prev = _context2.next) {
|
|
259
255
|
case 0:
|
|
260
|
-
designProductionMethod = (0, _Selectors2.getSelectedDesignProductionMethod)(getState());
|
|
261
|
-
vectorizedLogoMandatory = (0, _Selectors2.isVectorizedLogoMandatory)(designProductionMethod);
|
|
262
256
|
data = new FormData();
|
|
263
257
|
createCopy = editData.createCopy;
|
|
264
258
|
data.append('userImageEditData', JSON.stringify(editData));
|
|
265
259
|
dispatch(dismissError());
|
|
266
|
-
_context2.next =
|
|
260
|
+
_context2.next = 6;
|
|
267
261
|
return dispatch((0, _Actions.postDataAsync)(URL_UPLOAD, data, (0, _Actions.createDefaultReceiver)(RECEIVE_IMAGE_UPLOAD_DATA, _objectSpread({
|
|
268
262
|
imageData: imageData,
|
|
269
|
-
createCopy: createCopy
|
|
270
|
-
vectorizedLogoMandatory: vectorizedLogoMandatory
|
|
263
|
+
createCopy: createCopy
|
|
271
264
|
}, actionOptions))));
|
|
272
265
|
|
|
273
|
-
case
|
|
266
|
+
case 6:
|
|
274
267
|
uploadResponse = _context2.sent;
|
|
275
|
-
_context2.next =
|
|
268
|
+
_context2.next = 9;
|
|
276
269
|
return (0, _DesignDataService.calculateImageBrightness)(uploadResponse);
|
|
277
270
|
|
|
278
|
-
case
|
|
271
|
+
case 9:
|
|
279
272
|
return _context2.abrupt("return", _context2.sent);
|
|
280
273
|
|
|
281
|
-
case
|
|
274
|
+
case 10:
|
|
282
275
|
case "end":
|
|
283
276
|
return _context2.stop();
|
|
284
277
|
}
|
|
@@ -286,7 +279,7 @@ var editImage = function editImage(editData, imageData) {
|
|
|
286
279
|
}, _callee2);
|
|
287
280
|
}));
|
|
288
281
|
|
|
289
|
-
return function (
|
|
282
|
+
return function (_x2) {
|
|
290
283
|
return _ref2.apply(this, arguments);
|
|
291
284
|
};
|
|
292
285
|
}());
|
|
@@ -65,11 +65,6 @@ var updateDerivedImageDataProps = function updateDerivedImageDataProps(imageData
|
|
|
65
65
|
imageData.displayColorPreview = (0, _configuration.getConf)('autoPreviewVectorization', true);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
if (imageData.vectorizedLogoMandatory) {
|
|
69
|
-
imageData.colorPreviewEnabled = false;
|
|
70
|
-
imageData.displayColorPreview = true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
68
|
return imageData;
|
|
74
69
|
};
|
|
75
70
|
|
|
@@ -195,7 +195,7 @@ var isColorPreviewCompatible = function isColorPreviewCompatible(state, image, d
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
var designProductionMethod = designProductionMethodIdentifier ? (0, _Selectors2.getDesignProductionMethodByIdentifier)(state, designProductionMethodIdentifier) : (0, _Selectors2.getSelectedDesignProductionMethod)(state);
|
|
198
|
-
var colorPreviewRequired = (0, _Selectors2.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod)
|
|
198
|
+
var colorPreviewRequired = (0, _Selectors2.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod);
|
|
199
199
|
var displayColorPreview = image && (!!image.gallery || !!image.displayColorPreview); // do not let the user to add a raster image if the production method is embroidery
|
|
200
200
|
|
|
201
201
|
return !colorPreviewRequired || displayColorPreview || false;
|
|
@@ -69,7 +69,7 @@ var prepareImageData = function createImageDataPreProcessor() {
|
|
|
69
69
|
|
|
70
70
|
return /*#__PURE__*/function () {
|
|
71
71
|
var _prepareImageData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(designArea, imageData) {
|
|
72
|
-
var hash, state, designProductionMethod, patchedImageData, colorPreviewRequired,
|
|
72
|
+
var hash, state, designProductionMethod, patchedImageData, colorPreviewRequired, svgContent, svgColors, vectorizeColorsMap;
|
|
73
73
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
74
74
|
while (1) {
|
|
75
75
|
switch (_context.prev = _context.next) {
|
|
@@ -93,32 +93,31 @@ var prepareImageData = function createImageDataPreProcessor() {
|
|
|
93
93
|
|
|
94
94
|
case 6:
|
|
95
95
|
colorPreviewRequired = (0, _Selectors.designProductionMethodHasEmbroideryVisualizationEffect)(designProductionMethod);
|
|
96
|
-
vectorizedLogoMandatory = (0, _Selectors.isVectorizedLogoMandatory)(designProductionMethod);
|
|
97
96
|
|
|
98
97
|
if (!colorPreviewRequired) {
|
|
99
|
-
_context.next =
|
|
98
|
+
_context.next = 16;
|
|
100
99
|
break;
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
_context.next =
|
|
102
|
+
_context.next = 10;
|
|
104
103
|
return (0, _DesignDataService.getSvgContent)(imageData.preview.url, false, true);
|
|
105
104
|
|
|
106
|
-
case
|
|
105
|
+
case 10:
|
|
107
106
|
svgContent = _context.sent;
|
|
108
107
|
svgColors = (0, _DesignDataService.getSvgColors)(svgContent, designProductionMethod);
|
|
109
108
|
vectorizeColorsMap = (0, _Modifiers.createVectorizeColorsMap)({}, svgColors);
|
|
110
109
|
patchedImageData = _objectSpread(_objectSpread({}, imageData), {}, {
|
|
111
110
|
colorPreviewRequired: true,
|
|
112
111
|
displayColorPreview: true,
|
|
113
|
-
colorPreviewEnabled:
|
|
112
|
+
colorPreviewEnabled: true,
|
|
114
113
|
operations: _objectSpread(_objectSpread({}, imageData.operations), {}, {
|
|
115
114
|
vectorizeColorsMap: vectorizeColorsMap
|
|
116
115
|
})
|
|
117
116
|
});
|
|
118
|
-
_context.next =
|
|
117
|
+
_context.next = 17;
|
|
119
118
|
break;
|
|
120
119
|
|
|
121
|
-
case
|
|
120
|
+
case 16:
|
|
122
121
|
// the color replacement call returns the same url for every call, making the browser serve the image
|
|
123
122
|
// from cache, to force reloading a random query string has to be added to the url
|
|
124
123
|
patchedImageData = _objectSpread(_objectSpread({}, imageData), {}, {
|
|
@@ -127,11 +126,11 @@ var prepareImageData = function createImageDataPreProcessor() {
|
|
|
127
126
|
})
|
|
128
127
|
});
|
|
129
128
|
|
|
130
|
-
case
|
|
129
|
+
case 17:
|
|
131
130
|
imageDataMemo.set(designProductionMethod.identifier, patchedImageData);
|
|
132
131
|
return _context.abrupt("return", patchedImageData);
|
|
133
132
|
|
|
134
|
-
case
|
|
133
|
+
case 19:
|
|
135
134
|
case "end":
|
|
136
135
|
return _context.stop();
|
|
137
136
|
}
|