@configuratorware/configurator-frontendgui 1.30.0 → 1.30.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/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +3 -3
- package/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +1 -2
- package/App/Modules/Designer/Containers/ImageEditDialog.js +6 -3
- package/App/Modules/Designer/Utils/Transformers.js +1 -1
- package/App/Reducers/ImageGallery/Selectors.js +1 -7
- package/package.json +4 -4
- package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js +2 -5
- package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.test.js +1 -0
- package/src/App/Modules/Designer/Components/ImageColorPicker/ImageColorPicker.js +1 -3
- package/src/App/Modules/Designer/Containers/ImageEditDialog.js +3 -0
- package/src/App/Modules/Designer/Utils/Transformers.js +2 -1
- package/src/App/Reducers/ImageGallery/Selectors.js +0 -2
- package/src/App/Reducers/ImageGallery/__tests__/Selectors.test.js +0 -13
package/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js
CHANGED
|
@@ -13,8 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
15
15
|
|
|
16
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
|
17
|
-
|
|
18
16
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
19
17
|
|
|
20
18
|
var _withStyles = _interopRequireDefault(require("@material-ui/core/styles/withStyles"));
|
|
@@ -41,6 +39,8 @@ var _Selectors2 = require("../../../../Reducers/DesignData/Selectors");
|
|
|
41
39
|
|
|
42
40
|
var _i18n = require("../../../../../Framework/i18n");
|
|
43
41
|
|
|
42
|
+
var _Transformers = require("../../Utils/Transformers");
|
|
43
|
+
|
|
44
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
45
|
|
|
46
46
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -156,7 +156,7 @@ var _handleObjectButtonClick = function handleObjectButtonClick(evt, canvas, onM
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
var isOriginallyVector = function isOriginallyVector(object) {
|
|
159
|
-
return object && object.type === 'Image' &&
|
|
159
|
+
return object && object.type === 'Image' && (0, _Transformers.isOriginalVector)(object.imageData) || false;
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
exports.isOriginallyVector = isOriginallyVector;
|
|
@@ -342,9 +342,8 @@ var ImageColorPicker = /*#__PURE__*/function (_React$Component) {
|
|
|
342
342
|
|
|
343
343
|
var ow = img.width,
|
|
344
344
|
oh = img.height;
|
|
345
|
-
var oa = ow / oh;
|
|
346
345
|
|
|
347
|
-
if (
|
|
346
|
+
if (ow / oh <= pw / ph) {
|
|
348
347
|
var height = ph;
|
|
349
348
|
var width = height * (ow / oh);
|
|
350
349
|
this.updateCanvasDimensionsAndContent(canvas, img, width, height);
|
|
@@ -940,7 +940,8 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
940
940
|
ImageColorizeComponent = _this$props6.ImageColorizeComponent,
|
|
941
941
|
ImageUploadComponent = _this$props6.ImageUploadComponent,
|
|
942
942
|
customControlElements = _this$props6.customControlElements,
|
|
943
|
-
checkOwnership = _this$props6.checkOwnership
|
|
943
|
+
checkOwnership = _this$props6.checkOwnership,
|
|
944
|
+
designProductionMethod = _this$props6.designProductionMethod;
|
|
944
945
|
var _this$state3 = this.state,
|
|
945
946
|
preview = _this$state3.preview,
|
|
946
947
|
clipping = _this$state3.clipping,
|
|
@@ -996,7 +997,8 @@ var ImageEditDialogContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
996
997
|
imageColorsWereEdited: imageColorsWereEdited,
|
|
997
998
|
vectorsRequired: vectorsRequired,
|
|
998
999
|
colorAmountList: colorAmountList,
|
|
999
|
-
customControlElements: customControlElements
|
|
1000
|
+
customControlElements: customControlElements,
|
|
1001
|
+
designProductionMethodName: designProductionMethod === null || designProductionMethod === void 0 ? void 0 : designProductionMethod.title
|
|
1000
1002
|
}),
|
|
1001
1003
|
activeTabIndex: activeTabIndex,
|
|
1002
1004
|
onActiveTabChange: this.onActiveTabChange,
|
|
@@ -1142,7 +1144,8 @@ var mapStateToProps = function mapStateToProps(state) {
|
|
|
1142
1144
|
usedColors: usedColors,
|
|
1143
1145
|
hasPlaceHolderImage: hasPlaceHolderImage,
|
|
1144
1146
|
initialColorMaxAmount: initialColorMaxAmount,
|
|
1145
|
-
colorPreviewRequirementFulfilled: colorPreviewRequirementFulfilled
|
|
1147
|
+
colorPreviewRequirementFulfilled: colorPreviewRequirementFulfilled,
|
|
1148
|
+
designProductionMethod: designProductionMethod
|
|
1146
1149
|
};
|
|
1147
1150
|
};
|
|
1148
1151
|
|
|
@@ -61,7 +61,7 @@ var getRasterURL = function getRasterURL(imageURL) {
|
|
|
61
61
|
exports.getRasterURL = getRasterURL;
|
|
62
62
|
|
|
63
63
|
var isOriginalVector = function isOriginalVector(imageData) {
|
|
64
|
-
return
|
|
64
|
+
return /^(eps|ept|ps|pdf|ai|svg)$/i.test((0, _get["default"])(imageData, 'original.format', ''));
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
exports.isOriginalVector = isOriginalVector;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isColorPreviewCompatible = exports.isHardModified = exports.showVectorizeImageQuality = exports.
|
|
6
|
+
exports.isColorPreviewCompatible = exports.isHardModified = exports.showVectorizeImageQuality = exports.isColorMappingCompatible = exports.isImageReadyToBeAdded = exports.isImageCompatible = exports.isAddMode = exports.isEditMode = exports.getImageUsageInfo = exports.getUserImagesByDesignArea = exports.getUserImage = exports.isEditableVectorImage = exports.getPreviewUrlFromImageData = void 0;
|
|
7
7
|
|
|
8
8
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
9
9
|
|
|
@@ -165,12 +165,6 @@ var isColorMappingCompatible = function isColorMappingCompatible(colorPalettes,
|
|
|
165
165
|
|
|
166
166
|
exports.isColorMappingCompatible = isColorMappingCompatible;
|
|
167
167
|
|
|
168
|
-
var isVectorFormat = function isVectorFormat(extension) {
|
|
169
|
-
return /^(eps|pdf|ai|svg)$/i.test(extension);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
exports.isVectorFormat = isVectorFormat;
|
|
173
|
-
|
|
174
168
|
var showVectorizeImageQuality = function showVectorizeImageQuality(imageToAnalyse) {
|
|
175
169
|
var minimumPixelAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
176
170
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configuratorware/configurator-frontendgui",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.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.30.
|
|
9
|
+
"@configuratorware/scripts": "1.30.3",
|
|
10
10
|
"@hot-loader/react-dom": "^17.0.1",
|
|
11
11
|
"@material-ui/core": "^4.12.2",
|
|
12
12
|
"@material-ui/icons": "^4.11.2",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"react-router-dom": "^5.2.0",
|
|
40
40
|
"react-swipeable": "^5.5.1",
|
|
41
41
|
"react-zoom-pan-pinch": "^2.1.3",
|
|
42
|
-
"redhotmagma-graphics-editor": "1.30.
|
|
43
|
-
"redhotmagma-visualization": "1.30.
|
|
42
|
+
"redhotmagma-graphics-editor": "1.30.3",
|
|
43
|
+
"redhotmagma-visualization": "1.30.3",
|
|
44
44
|
"redux": "^4.1.0",
|
|
45
45
|
"redux-logger": "^3.0.6",
|
|
46
46
|
"redux-persist": "^5.10.0",
|
package/src/App/Modules/Designer/Components/DesignerSelectionToolbox/DesignerSelectionToolbox.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import get from 'lodash/get';
|
|
5
4
|
import cloneDeep from 'lodash/cloneDeep';
|
|
6
5
|
import withStyles from '@material-ui/core/styles/withStyles';
|
|
7
6
|
import withWidth from '@material-ui/core/withWidth/withWidth';
|
|
@@ -15,6 +14,7 @@ import { isPlaceholderContent } from 'App/Reducers/DesignArea/Selectors';
|
|
|
15
14
|
import isMobileDevice from 'Framework/Helpers/isMobileDevice';
|
|
16
15
|
import { hasBackgroundColor } from 'App/Reducers/DesignData/Selectors';
|
|
17
16
|
import { t } from 'Framework/i18n';
|
|
17
|
+
import { isOriginalVector } from '../../Utils/Transformers';
|
|
18
18
|
|
|
19
19
|
const styles = theme => ({
|
|
20
20
|
root: {
|
|
@@ -98,10 +98,7 @@ const handleObjectButtonClick = (evt, canvas, onMoveUpClick, onMoveDownClick) =>
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
export const isOriginallyVector = object =>
|
|
101
|
-
(object &&
|
|
102
|
-
object.type === 'Image' &&
|
|
103
|
-
/^(eps|pdf|ai|svg)$/i.test(get(object, 'imageData.original.format', ''))) ||
|
|
104
|
-
false;
|
|
101
|
+
(object && object.type === 'Image' && isOriginalVector(object.imageData)) || false;
|
|
105
102
|
|
|
106
103
|
const isRaster = object =>
|
|
107
104
|
(object && object.type === 'Image' && /\.(jpe?g|png|gif)$/i.test(object.src)) || false;
|
|
@@ -23,6 +23,7 @@ describe('Designer/DesignerSelectionToolbox', () => {
|
|
|
23
23
|
const createObject = (type, format) => ({ type, imageData: { original: { format } } });
|
|
24
24
|
|
|
25
25
|
expect(isOriginallyVector(createObject('Image', 'eps'))).toEqual(true);
|
|
26
|
+
expect(isOriginallyVector(createObject('Image', 'ept'))).toEqual(true);
|
|
26
27
|
expect(isOriginallyVector(createObject('Image', 'pdf'))).toEqual(true);
|
|
27
28
|
expect(isOriginallyVector(createObject('Image', 'ai'))).toEqual(true);
|
|
28
29
|
expect(isOriginallyVector(createObject('Image', 'svg'))).toEqual(true);
|
|
@@ -210,9 +210,7 @@ export class ImageColorPicker extends React.Component {
|
|
|
210
210
|
const { width: pw, height: ph } = container.getBoundingClientRect();
|
|
211
211
|
const { width: ow, height: oh } = img;
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (oa <= 1) {
|
|
213
|
+
if (ow / oh <= pw / ph) {
|
|
216
214
|
const height = ph;
|
|
217
215
|
const width = height * (ow / oh);
|
|
218
216
|
|
|
@@ -649,6 +649,7 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
649
649
|
ImageUploadComponent,
|
|
650
650
|
customControlElements,
|
|
651
651
|
checkOwnership,
|
|
652
|
+
designProductionMethod,
|
|
652
653
|
} = this.props;
|
|
653
654
|
const {
|
|
654
655
|
preview,
|
|
@@ -718,6 +719,7 @@ export class ImageEditDialogContainer extends React.Component {
|
|
|
718
719
|
vectorsRequired={vectorsRequired}
|
|
719
720
|
colorAmountList={colorAmountList}
|
|
720
721
|
customControlElements={customControlElements}
|
|
722
|
+
designProductionMethodName={designProductionMethod?.title}
|
|
721
723
|
/>
|
|
722
724
|
}
|
|
723
725
|
activeTabIndex={activeTabIndex}
|
|
@@ -818,6 +820,7 @@ const mapStateToProps = state => {
|
|
|
818
820
|
hasPlaceHolderImage,
|
|
819
821
|
initialColorMaxAmount,
|
|
820
822
|
colorPreviewRequirementFulfilled,
|
|
823
|
+
designProductionMethod,
|
|
821
824
|
};
|
|
822
825
|
};
|
|
823
826
|
|
|
@@ -19,7 +19,8 @@ export const fixSrcURL = src => {
|
|
|
19
19
|
|
|
20
20
|
export const getRasterURL = imageURL => ('' + imageURL).replace(/svg$/, 'png');
|
|
21
21
|
|
|
22
|
-
export const isOriginalVector = imageData =>
|
|
22
|
+
export const isOriginalVector = imageData =>
|
|
23
|
+
/^(eps|ept|ps|pdf|ai|svg)$/i.test(get(imageData, 'original.format', ''));
|
|
23
24
|
|
|
24
25
|
export const noCache = src => `${src}?${Math.random()}`;
|
|
25
26
|
|
|
@@ -115,8 +115,6 @@ export const isColorMappingCompatible = (colorPalettes, vectorizeColorsMap) => {
|
|
|
115
115
|
);
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
export const isVectorFormat = extension => /^(eps|pdf|ai|svg)$/i.test(extension);
|
|
119
|
-
|
|
120
118
|
export const showVectorizeImageQuality = (imageToAnalyse, minimumPixelAmount = null) => {
|
|
121
119
|
if (imageToAnalyse) {
|
|
122
120
|
const pixelsInTheImage =
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
isImageCompatible,
|
|
9
9
|
isImageReadyToBeAdded,
|
|
10
10
|
showVectorizeImageQuality,
|
|
11
|
-
isVectorFormat,
|
|
12
11
|
isHardModified,
|
|
13
12
|
isColorPreviewCompatible,
|
|
14
13
|
getPreviewUrlFromImageData,
|
|
@@ -624,18 +623,6 @@ describe('Reducers/ImageGallery/Selectors', () => {
|
|
|
624
623
|
});
|
|
625
624
|
});
|
|
626
625
|
|
|
627
|
-
test('isVectorFormat returns true for known vector formats, otherwise false', () => {
|
|
628
|
-
[
|
|
629
|
-
['eps', true],
|
|
630
|
-
['pdf', true],
|
|
631
|
-
['ai', true],
|
|
632
|
-
['svg', true],
|
|
633
|
-
['png', false],
|
|
634
|
-
['jpg', false],
|
|
635
|
-
['gif', false],
|
|
636
|
-
].forEach(([format, expectedValue]) => expect(isVectorFormat(format)).toBe(expectedValue));
|
|
637
|
-
});
|
|
638
|
-
|
|
639
626
|
test('isHardModified returns true if the related props are changed', () => {
|
|
640
627
|
expect(
|
|
641
628
|
isHardModified(
|