@configuratorware/configurator-frontendgui 1.40.2 → 1.40.4

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.
@@ -86,6 +86,8 @@ import {
86
86
  getVectorizeForDesignProductionMethods,
87
87
  getImagesByDesignArea,
88
88
  designProductionMethodHasEmbroideryVisualizationEffect,
89
+ getMandatoryVectorizationForDesignProductionMethods,
90
+ isVectorizedLogoMandatory,
89
91
  } from '../Reducers/DesignArea/Selectors';
90
92
  import {
91
93
  getUserImage,
@@ -1075,6 +1077,33 @@ export default class DesignDataService {
1075
1077
  }
1076
1078
  };
1077
1079
 
1080
+ handleDesignProductionMethodChangeToMandatoryVectorization = async designProductionMethodIdentifier => {
1081
+ const state = Services.store.state;
1082
+
1083
+ const {
1084
+ currentVectorsMandatory,
1085
+ newVectorsMandatory,
1086
+ } = getMandatoryVectorizationForDesignProductionMethods(state, designProductionMethodIdentifier);
1087
+
1088
+ const designArea = getSelectedDesignArea(state);
1089
+ const nonColorizedImages = getImagesByDesignArea(state, designArea.identifier).filter(
1090
+ obj => !get(obj, 'imageData.gallery') && !get(obj, 'imageData.displayColorPreview')
1091
+ );
1092
+
1093
+ if (
1094
+ nonColorizedImages.length === 1 &&
1095
+ ((!currentVectorsMandatory && newVectorsMandatory) ||
1096
+ !isColorPreviewCompatible(
1097
+ state,
1098
+ nonColorizedImages[0].imageData,
1099
+ designProductionMethodIdentifier
1100
+ ))
1101
+ ) {
1102
+ await Services.store.dispatch(showSwitchToProductionMethodWithVectorization());
1103
+ return true;
1104
+ }
1105
+ };
1106
+
1078
1107
  checkColorUsageForDesignProductionMethod = async designProductionMethodIdentifier => {
1079
1108
  const state = Services.store.state;
1080
1109
  const { maxColorAmount, designProductionMethod } = getSelectedDesignAreaProperties(state);
@@ -1086,9 +1115,9 @@ export default class DesignDataService {
1086
1115
  const currentVectorsRequired = !!get(designProductionMethod, 'options.vectorsRequired');
1087
1116
  const newVectorsRequired = !!get(newProductionMethod, 'options.vectorsRequired');
1088
1117
  const designArea = getSelectedDesignArea(state);
1089
- const colorPreviewRequired = designProductionMethodHasEmbroideryVisualizationEffect(
1090
- newProductionMethod
1091
- );
1118
+ const colorPreviewRequired =
1119
+ designProductionMethodHasEmbroideryVisualizationEffect(newProductionMethod) ||
1120
+ isVectorizedLogoMandatory(newProductionMethod);
1092
1121
 
1093
1122
  if (
1094
1123
  (newMaxColorAmount !== 0 && newMaxColorAmount < maxColorAmount) ||
@@ -1116,6 +1145,8 @@ export default class DesignDataService {
1116
1145
  images.forEach(object => {
1117
1146
  object.remove();
1118
1147
  });
1148
+
1149
+ await this.updateCanvasData(canvas);
1119
1150
  }
1120
1151
  }
1121
1152
 
@@ -1194,9 +1225,9 @@ export default class DesignDataService {
1194
1225
  };
1195
1226
 
1196
1227
  async vectorizeSingleImageAndShowEditDialog(identifier) {
1197
- const showImageEditDialog = await this.handleDesignProductionMethodChangeFromNonVectorizationToVectorization(
1198
- identifier
1199
- );
1228
+ const showImageEditDialog =
1229
+ (await this.handleDesignProductionMethodChangeFromNonVectorizationToVectorization(identifier)) ||
1230
+ (await this.handleDesignProductionMethodChangeToMandatoryVectorization(identifier));
1200
1231
 
1201
1232
  if (showImageEditDialog) {
1202
1233
  Services.ui.show('globalLoader');
@@ -1204,16 +1235,22 @@ export default class DesignDataService {
1204
1235
  const state = Services.store.state;
1205
1236
  const designArea = getSelectedDesignArea(state);
1206
1237
  const canvas = this._getCanvas(designArea);
1207
- const firstNonVectorizedImage = getImagesByDesignArea(state, designArea.identifier).find(
1208
- obj => !get(obj, 'imageData.operations.vectorize')
1238
+
1239
+ const images = getImagesByDesignArea(state, designArea.identifier);
1240
+ const firstNonVectorizedImage = images.find(
1241
+ obj =>
1242
+ !get(obj, 'imageData.gallery') &&
1243
+ (!get(obj, 'imageData.operations.vectorize') ||
1244
+ !get(obj, 'imageData.displayColorPreview'))
1209
1245
  );
1210
- const operations = {
1211
- ...firstNonVectorizedImage.imageData.operations,
1212
- vectorize: true,
1213
- };
1214
- const imageData = firstNonVectorizedImage.imageData;
1215
1246
 
1216
1247
  try {
1248
+ const operations = {
1249
+ ...firstNonVectorizedImage.imageData.operations,
1250
+ vectorize: true,
1251
+ };
1252
+ const imageData = firstNonVectorizedImage.imageData;
1253
+
1217
1254
  //returing if placeHolderImage, from executing edit operations
1218
1255
  if (imageData.isPlaceHolderImage) {
1219
1256
  return;
@@ -1855,13 +1892,16 @@ export default class DesignDataService {
1855
1892
  const compatibilityInfoHash = getDesignAreaImageCompatibilityInfo(designProductionMethod);
1856
1893
  const imageIsCompatible = areHashesCompatible(image.compatibilityInfoHash, compatibilityInfoHash);
1857
1894
  const operationsMatching = compareOperations(image.operations, operations);
1858
- const colorPreviewRequired = designProductionMethodHasEmbroideryVisualizationEffect(
1859
- designProductionMethod
1860
- );
1895
+ const vectorizedLogoMandatory = isVectorizedLogoMandatory(designProductionMethod);
1896
+
1897
+ const colorPreviewRequired =
1898
+ designProductionMethodHasEmbroideryVisualizationEffect(designProductionMethod) ||
1899
+ vectorizedLogoMandatory;
1861
1900
 
1862
1901
  const imageDataPatch = {
1863
1902
  compatibilityInfoHash,
1864
1903
  colorPreviewRequired,
1904
+ vectorizedLogoMandatory,
1865
1905
  ...(displayColorPreview !== undefined && { displayColorPreview }),
1866
1906
  };
1867
1907
 
@@ -13,7 +13,7 @@ const DEVELOPMENT_HOST_LOCAL = 'http://localhost:10030';
13
13
 
14
14
  const hostsByNodeEnv = {
15
15
  production: '',
16
- development: DEVELOPMENT_HOST_INT,
16
+ development: DEVELOPMENT_HOST_LOCAL,
17
17
  test: '',
18
18
  };
19
19