@yorab/react-paint 0.6.1 → 0.6.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.
- package/Changelog.md +19 -0
- package/README.md +0 -1
- package/dist/components/App.js +48 -27
- package/dist/components/common/Modal.js +5 -1
- package/dist/components/common/Panel.js +3 -0
- package/dist/components/settings/ColorField.js +18 -8
- package/dist/components/settings/FontFamilyField.js +3 -0
- package/dist/components/settings/LineArrowField.js +3 -0
- package/dist/components/settings/LineTypeField.js +4 -1
- package/dist/components/settings/PointsNumberField.js +3 -0
- package/dist/components/settings/RangeField.js +5 -2
- package/dist/components/settings/SelectField.js +10 -3
- package/dist/components/settings/SettingsBar.js +160 -71
- package/dist/components/toolbox/EditTextBox.js +16 -2
- package/dist/components/toolbox/LoadFileTool.js +3 -3
- package/dist/components/toolbox/MenuGroup.js +1 -3
- package/dist/components/toolbox/Tool.js +3 -3
- package/dist/components/toolbox/Toolbar.js +2 -5
- package/dist/constants/icons.js +19 -9
- package/dist/constants/style.js +1 -1
- package/dist/constants/tools.js +22 -22
- package/dist/styles.css +11 -8
- package/dist/utils/intersect.js +1 -0
- package/package.json +1 -1
package/Changelog.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# V0.6.4
|
|
2
|
+
|
|
3
|
+
- fix TextEdit copy/paste containing html
|
|
4
|
+
- add clearCallback in opts to override clear button behavior
|
|
5
|
+
|
|
6
|
+
# V0.6.3
|
|
7
|
+
|
|
8
|
+
- Rename 'lib' prop in 'label'
|
|
9
|
+
- update dash settings
|
|
10
|
+
- update clear icon
|
|
11
|
+
- update color settings UI
|
|
12
|
+
|
|
13
|
+
# V0.6.2
|
|
14
|
+
|
|
15
|
+
- Lock : can't select shape by click on it (only via layers panel)
|
|
16
|
+
- Clear : reset state to shapes prop by default if not undefined
|
|
17
|
+
- update icons
|
|
18
|
+
- Add responsive to settings UI
|
|
19
|
+
|
|
1
20
|
# V0.6.1
|
|
2
21
|
|
|
3
22
|
- Fix shapes prop not refreshing component (introduced by 0.6.0)
|
package/README.md
CHANGED
package/dist/components/App.js
CHANGED
|
@@ -143,6 +143,7 @@ var DEFAULT_OPTIONS = {
|
|
|
143
143
|
withUploadPicture: true,
|
|
144
144
|
withUrlPicture: false,
|
|
145
145
|
availableTools: _tools.DEFAULT_SHAPE_TOOLS,
|
|
146
|
+
clearCallback: 'empty',
|
|
146
147
|
uiStyle: {
|
|
147
148
|
toolbarBackgroundColor: 'white',
|
|
148
149
|
dividerColor: '#36418129',
|
|
@@ -188,6 +189,7 @@ var App = function App(_ref5) {
|
|
|
188
189
|
withLoadAndSave = _DEFAULT_OPTIONS$opti.withLoadAndSave,
|
|
189
190
|
withUploadPicture = _DEFAULT_OPTIONS$opti.withUploadPicture,
|
|
190
191
|
withUrlPicture = _DEFAULT_OPTIONS$opti.withUrlPicture,
|
|
192
|
+
clearCallback = _DEFAULT_OPTIONS$opti.clearCallback,
|
|
191
193
|
availableToolsFromProps = _DEFAULT_OPTIONS$opti.availableTools;
|
|
192
194
|
|
|
193
195
|
var _DEFAULT_OPTIONS$uiSt = _objectSpread(_objectSpread({}, DEFAULT_OPTIONS.uiStyle), (_options$uiStyle = options === null || options === void 0 ? void 0 : options.uiStyle) !== null && _options$uiStyle !== void 0 ? _options$uiStyle : {}),
|
|
@@ -318,13 +320,57 @@ var App = function App(_ref5) {
|
|
|
318
320
|
selectTool(_tools.SELECTION_TOOL);
|
|
319
321
|
forwardShape();
|
|
320
322
|
}, [selectTool, forwardShape]);
|
|
321
|
-
var
|
|
323
|
+
var resetCanvas = (0, _react.useCallback)(function () {
|
|
322
324
|
var shapesToInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
323
325
|
var clearHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
324
326
|
clearShapes(shapesToInit, clearHistory);
|
|
325
327
|
selectTool(_tools.SELECTION_TOOL);
|
|
326
328
|
setCanvasOffset([0, 0]);
|
|
327
329
|
}, [selectTool, clearShapes]);
|
|
330
|
+
var loadImportedData = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
331
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(json) {
|
|
332
|
+
var clearHistory,
|
|
333
|
+
shapes,
|
|
334
|
+
_args = arguments;
|
|
335
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
336
|
+
while (1) {
|
|
337
|
+
switch (_context.prev = _context.next) {
|
|
338
|
+
case 0:
|
|
339
|
+
clearHistory = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
|
|
340
|
+
_context.next = 3;
|
|
341
|
+
return (0, _file.decodeImportedData)(json);
|
|
342
|
+
|
|
343
|
+
case 3:
|
|
344
|
+
shapes = _context.sent;
|
|
345
|
+
resetCanvas(shapes, clearHistory);
|
|
346
|
+
|
|
347
|
+
case 5:
|
|
348
|
+
case "end":
|
|
349
|
+
return _context.stop();
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}, _callee);
|
|
353
|
+
}));
|
|
354
|
+
|
|
355
|
+
return function (_x) {
|
|
356
|
+
return _ref6.apply(this, arguments);
|
|
357
|
+
};
|
|
358
|
+
}(), [resetCanvas]);
|
|
359
|
+
var clearCanvas = (0, _react.useCallback)(function () {
|
|
360
|
+
if (typeof clearCallback !== 'string') {
|
|
361
|
+
void loadImportedData({
|
|
362
|
+
shapes: clearCallback()
|
|
363
|
+
}, false);
|
|
364
|
+
} else {
|
|
365
|
+
if (clearCallback === 'defaultShapes' && shapesFromProps !== undefined) {
|
|
366
|
+
void loadImportedData({
|
|
367
|
+
shapes: shapesFromProps
|
|
368
|
+
}, false);
|
|
369
|
+
} else {
|
|
370
|
+
resetCanvas();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}, [resetCanvas, loadImportedData, shapesFromProps, clearCallback]);
|
|
328
374
|
var selectShape = (0, _react.useCallback)(function (shape) {
|
|
329
375
|
setActiveTool(_tools.SELECTION_TOOL);
|
|
330
376
|
setSelectedShape(shape);
|
|
@@ -383,32 +429,6 @@ var App = function App(_ref5) {
|
|
|
383
429
|
setIsLoading(false);
|
|
384
430
|
}
|
|
385
431
|
}, [shapesRef, addSnackbar, canvasWidth, canvasHeight]);
|
|
386
|
-
var loadImportedData = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
387
|
-
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(json) {
|
|
388
|
-
var shapes;
|
|
389
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
390
|
-
while (1) {
|
|
391
|
-
switch (_context.prev = _context.next) {
|
|
392
|
-
case 0:
|
|
393
|
-
_context.next = 2;
|
|
394
|
-
return (0, _file.decodeImportedData)(json);
|
|
395
|
-
|
|
396
|
-
case 2:
|
|
397
|
-
shapes = _context.sent;
|
|
398
|
-
clearCanvas(shapes, true);
|
|
399
|
-
|
|
400
|
-
case 4:
|
|
401
|
-
case "end":
|
|
402
|
-
return _context.stop();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}, _callee);
|
|
406
|
-
}));
|
|
407
|
-
|
|
408
|
-
return function (_x) {
|
|
409
|
-
return _ref6.apply(this, arguments);
|
|
410
|
-
};
|
|
411
|
-
}(), [clearCanvas]);
|
|
412
432
|
var loadFile = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
413
433
|
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(file) {
|
|
414
434
|
var json;
|
|
@@ -637,6 +657,7 @@ var App = function App(_ref5) {
|
|
|
637
657
|
toggleShapeLock: toggleShapeLock,
|
|
638
658
|
isLayoutPanelShown: isLayoutPanelShown
|
|
639
659
|
})), isEditMode && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_SettingsBar["default"], {
|
|
660
|
+
width: canvasSize.width,
|
|
640
661
|
disabled: disabled,
|
|
641
662
|
activeTool: activeTool,
|
|
642
663
|
availableTools: availableTools,
|
|
@@ -29,8 +29,12 @@ var StyledMask = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
|
29
29
|
var Modal = function Modal(_ref) {
|
|
30
30
|
var children = _ref.children,
|
|
31
31
|
onClose = _ref.onClose,
|
|
32
|
+
_ref$position = _ref.position,
|
|
33
|
+
position = _ref$position === void 0 ? 'center' : _ref$position,
|
|
32
34
|
className = _ref.className;
|
|
33
|
-
return /*#__PURE__*/_react["default"].createElement(StyledModal,
|
|
35
|
+
return /*#__PURE__*/_react["default"].createElement(StyledModal, {
|
|
36
|
+
"data-position": position
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledMask, {
|
|
34
38
|
onClick: onClose
|
|
35
39
|
}), /*#__PURE__*/_react["default"].createElement(StyledPanel, {
|
|
36
40
|
className: className
|
|
@@ -33,12 +33,15 @@ var Panel = function Panel(_ref) {
|
|
|
33
33
|
_ref$title = _ref.title,
|
|
34
34
|
title = _ref$title === void 0 ? '' : _ref$title,
|
|
35
35
|
className = _ref.className,
|
|
36
|
+
_ref$fitContainer = _ref.fitContainer,
|
|
37
|
+
fitContainer = _ref$fitContainer === void 0 ? false : _ref$fitContainer,
|
|
36
38
|
_ref$alignment = _ref.alignment,
|
|
37
39
|
alignment = _ref$alignment === void 0 ? 'center' : _ref$alignment;
|
|
38
40
|
var componentRef = (0, _react.useRef)(null);
|
|
39
41
|
return /*#__PURE__*/_react["default"].createElement(StyledPanel, {
|
|
40
42
|
ref: componentRef,
|
|
41
43
|
className: className,
|
|
44
|
+
"data-fitcontainer": fitContainer,
|
|
42
45
|
"data-vertical": +vertical,
|
|
43
46
|
"data-alignment": alignment
|
|
44
47
|
}, title && /*#__PURE__*/_react["default"].createElement(StyledTitle, null, title), children);
|
|
@@ -37,11 +37,15 @@ var StyledColor = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
|
37
37
|
}]
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
+
var StyleWrapper = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
41
|
+
name: "StyleWrapper",
|
|
42
|
+
"class": "sfm1cqx"
|
|
43
|
+
});
|
|
40
44
|
var StyledCustomColor = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
41
45
|
name: "StyledCustomColor",
|
|
42
|
-
"class": "
|
|
46
|
+
"class": "sttf061",
|
|
43
47
|
vars: {
|
|
44
|
-
"
|
|
48
|
+
"sttf061-0": [function (_ref2) {
|
|
45
49
|
var color = _ref2.color;
|
|
46
50
|
return color;
|
|
47
51
|
}]
|
|
@@ -53,6 +57,8 @@ var ColorField = function ColorField(_ref3) {
|
|
|
53
57
|
setSelectedSettings = _ref3.setSelectedSettings,
|
|
54
58
|
_ref3$title = _ref3.title,
|
|
55
59
|
title = _ref3$title === void 0 ? 'Choisissez une couleur' : _ref3$title,
|
|
60
|
+
_ref3$mode = _ref3.mode,
|
|
61
|
+
mode = _ref3$mode === void 0 ? 'fill' : _ref3$mode,
|
|
56
62
|
_ref3$disabled = _ref3.disabled,
|
|
57
63
|
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
58
64
|
values = _ref3.values,
|
|
@@ -87,23 +93,27 @@ var ColorField = function ColorField(_ref3) {
|
|
|
87
93
|
selected: isPanelVisible,
|
|
88
94
|
title: title,
|
|
89
95
|
disabled: disabled,
|
|
90
|
-
onClick: togglePanel
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
onClick: togglePanel,
|
|
97
|
+
icon: value === 'transparent' ? mode === 'fill' ? _icons.noFillIcon : _icons.noStrokeIcon : undefined
|
|
98
|
+
}, value !== 'transparent' && /*#__PURE__*/_react["default"].createElement(StyledColor, {
|
|
99
|
+
color: value,
|
|
100
|
+
"data-mode": mode
|
|
93
101
|
})), isPanelVisible && /*#__PURE__*/_react["default"].createElement(_Panel["default"], {
|
|
94
102
|
title: title,
|
|
95
103
|
alignment: "left"
|
|
96
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
104
|
+
}, /*#__PURE__*/_react["default"].createElement(StyleWrapper, null, values.map(function (color, index) {
|
|
97
105
|
return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
98
106
|
title: color,
|
|
99
107
|
key: index,
|
|
100
108
|
selected: color === value,
|
|
101
109
|
color: color,
|
|
110
|
+
icon: color === 'transparent' ? mode === 'fill' ? _icons.noFillIcon : _icons.noStrokeIcon : undefined,
|
|
102
111
|
onClick: function onClick() {
|
|
103
112
|
return handleClick(color);
|
|
104
113
|
}
|
|
105
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledColor, {
|
|
106
|
-
color: color
|
|
114
|
+
}, color !== 'transparent' && /*#__PURE__*/_react["default"].createElement(StyledColor, {
|
|
115
|
+
color: color,
|
|
116
|
+
"data-mode": mode
|
|
107
117
|
}));
|
|
108
118
|
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
109
119
|
type: "color",
|
|
@@ -15,6 +15,8 @@ var _react2 = require("@linaria/react");
|
|
|
15
15
|
|
|
16
16
|
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
17
17
|
|
|
18
|
+
var _icons = require("../../constants/icons");
|
|
19
|
+
|
|
18
20
|
var StyledOption = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
19
21
|
name: "StyledOption",
|
|
20
22
|
"class": "smpmxx5",
|
|
@@ -47,6 +49,7 @@ var FontFamilyField = function FontFamilyField(_ref3) {
|
|
|
47
49
|
setSelectedSettings: setSelectedSettings,
|
|
48
50
|
CustomOption: FontFamilyOption,
|
|
49
51
|
title: "Font",
|
|
52
|
+
icon: _icons.fontIcon,
|
|
50
53
|
disabled: disabled,
|
|
51
54
|
field: "fontFamily",
|
|
52
55
|
values: values,
|
|
@@ -15,6 +15,8 @@ var _react2 = require("@linaria/react");
|
|
|
15
15
|
|
|
16
16
|
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
17
17
|
|
|
18
|
+
var _icons = require("../../constants/icons");
|
|
19
|
+
|
|
18
20
|
var StyledLeftTriangle = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
19
21
|
name: "StyledLeftTriangle",
|
|
20
22
|
"class": "s1xxj4yl"
|
|
@@ -49,6 +51,7 @@ var LineArrowField = function LineArrowField(_ref2) {
|
|
|
49
51
|
setSelectedSettings: setSelectedSettings,
|
|
50
52
|
CustomOption: LineArrowOption,
|
|
51
53
|
title: "Fl\xE8ches",
|
|
54
|
+
icon: _icons.lineEndIcon,
|
|
52
55
|
disabled: disabled,
|
|
53
56
|
field: "lineArrow",
|
|
54
57
|
values: values,
|
|
@@ -15,6 +15,8 @@ var _react2 = require("@linaria/react");
|
|
|
15
15
|
|
|
16
16
|
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
17
17
|
|
|
18
|
+
var _icons = require("../../constants/icons");
|
|
19
|
+
|
|
18
20
|
var StyledLine = /*#__PURE__*/(0, _react2.styled)("span")({
|
|
19
21
|
name: "StyledLine",
|
|
20
22
|
"class": "s1qssg4n"
|
|
@@ -28,7 +30,7 @@ var LineTypeOption = function LineTypeOption(_ref) {
|
|
|
28
30
|
var children = _ref.children;
|
|
29
31
|
return /*#__PURE__*/_react["default"].createElement(StyledOption, {
|
|
30
32
|
"data-type": children
|
|
31
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null)
|
|
33
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null), /*#__PURE__*/_react["default"].createElement(StyledLine, null));
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
exports.LineTypeOption = LineTypeOption;
|
|
@@ -46,6 +48,7 @@ var LineTypeField = function LineTypeField(_ref2) {
|
|
|
46
48
|
selectedSettings: selectedSettings,
|
|
47
49
|
setSelectedSettings: setSelectedSettings,
|
|
48
50
|
CustomOption: LineTypeOption,
|
|
51
|
+
icon: _icons.lineTypeIcon,
|
|
49
52
|
title: "Type de traits",
|
|
50
53
|
disabled: disabled,
|
|
51
54
|
field: "lineDash",
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _icons = require("../../constants/icons");
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _RangeField = _interopRequireDefault(require("./RangeField"));
|
|
@@ -25,6 +27,7 @@ var PointsNumberField = function PointsNumberField(_ref) {
|
|
|
25
27
|
return /*#__PURE__*/_react["default"].createElement(_RangeField["default"], {
|
|
26
28
|
selectedSettings: selectedSettings,
|
|
27
29
|
setSelectedSettings: setSelectedSettings,
|
|
30
|
+
icon: _icons.polygonIcon,
|
|
28
31
|
title: "Nombre de points",
|
|
29
32
|
disabled: disabled,
|
|
30
33
|
field: "pointsCount",
|
|
@@ -35,6 +35,7 @@ var RangeField = function RangeField(_ref) {
|
|
|
35
35
|
setSelectedSettings = _ref.setSelectedSettings,
|
|
36
36
|
_ref$title = _ref.title,
|
|
37
37
|
title = _ref$title === void 0 ? "Choisissez l'intervalle" : _ref$title,
|
|
38
|
+
icon = _ref.icon,
|
|
38
39
|
_ref$disabled = _ref.disabled,
|
|
39
40
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
40
41
|
field = _ref.field,
|
|
@@ -73,10 +74,12 @@ var RangeField = function RangeField(_ref) {
|
|
|
73
74
|
selected: isPanelVisible,
|
|
74
75
|
title: title,
|
|
75
76
|
disabled: disabled,
|
|
77
|
+
icon: icon,
|
|
76
78
|
onClick: togglePanel
|
|
77
|
-
}
|
|
79
|
+
}), isPanelVisible && /*#__PURE__*/_react["default"].createElement(_Panel["default"], {
|
|
78
80
|
title: title,
|
|
79
|
-
alignment: "left"
|
|
81
|
+
alignment: "left",
|
|
82
|
+
fitContainer: true
|
|
80
83
|
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(StyledLabel, null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
81
84
|
type: "range",
|
|
82
85
|
min: min,
|
|
@@ -29,6 +29,10 @@ var StyledButton = /*#__PURE__*/(0, _react2.styled)(_Button["default"])({
|
|
|
29
29
|
name: "StyledButton",
|
|
30
30
|
"class": "s1ktxhkr"
|
|
31
31
|
});
|
|
32
|
+
var StyleWrapper = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
33
|
+
name: "StyleWrapper",
|
|
34
|
+
"class": "s5sp14o"
|
|
35
|
+
});
|
|
32
36
|
|
|
33
37
|
var SelectField = function SelectField(_ref) {
|
|
34
38
|
var CustomOption = _ref.CustomOption,
|
|
@@ -39,6 +43,7 @@ var SelectField = function SelectField(_ref) {
|
|
|
39
43
|
_ref$disabled = _ref.disabled,
|
|
40
44
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
41
45
|
field = _ref.field,
|
|
46
|
+
icon = _ref.icon,
|
|
42
47
|
values = _ref.values,
|
|
43
48
|
defaultValue = _ref.defaultValue,
|
|
44
49
|
valueChanged = _ref.valueChanged;
|
|
@@ -62,12 +67,14 @@ var SelectField = function SelectField(_ref) {
|
|
|
62
67
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
63
68
|
selected: isPanelVisible,
|
|
64
69
|
title: title,
|
|
70
|
+
icon: icon,
|
|
65
71
|
disabled: disabled,
|
|
66
72
|
onClick: togglePanel
|
|
67
|
-
}
|
|
73
|
+
}), isPanelVisible && /*#__PURE__*/_react["default"].createElement(_Panel["default"], {
|
|
68
74
|
title: title,
|
|
69
|
-
alignment: "left"
|
|
70
|
-
|
|
75
|
+
alignment: "left",
|
|
76
|
+
fitContainer: true
|
|
77
|
+
}, /*#__PURE__*/_react["default"].createElement(StyleWrapper, null, values.map(function (value) {
|
|
71
78
|
return /*#__PURE__*/_react["default"].createElement(StyledButton, {
|
|
72
79
|
key: value,
|
|
73
80
|
title: "".concat(value),
|
|
@@ -41,6 +41,10 @@ var _ToggleField = _interopRequireDefault(require("./ToggleField"));
|
|
|
41
41
|
|
|
42
42
|
var _icons = require("../../constants/icons");
|
|
43
43
|
|
|
44
|
+
var _Button = _interopRequireDefault(require("../common/Button"));
|
|
45
|
+
|
|
46
|
+
var _Modal = _interopRequireDefault(require("../common/Modal"));
|
|
47
|
+
|
|
44
48
|
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); }
|
|
45
49
|
|
|
46
50
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -49,6 +53,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
49
53
|
|
|
50
54
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
51
55
|
|
|
56
|
+
var SETTING_WIDTH = 40;
|
|
52
57
|
var StyledSettingsBar = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
53
58
|
name: "StyledSettingsBar",
|
|
54
59
|
"class": "s16z54di"
|
|
@@ -57,77 +62,28 @@ var StyledSeparator = /*#__PURE__*/(0, _react2.styled)("div")({
|
|
|
57
62
|
name: "StyledSeparator",
|
|
58
63
|
"class": "sa7lzh9"
|
|
59
64
|
});
|
|
65
|
+
var StyledToolsModal = /*#__PURE__*/(0, _react2.styled)(_Modal["default"])({
|
|
66
|
+
name: "StyledToolsModal",
|
|
67
|
+
"class": "s7b85in"
|
|
68
|
+
});
|
|
60
69
|
|
|
61
|
-
var
|
|
70
|
+
var SettingsItems = function SettingsItems(_ref) {
|
|
62
71
|
var _selectedShape$style, _selectedShape$style2, _selectedShape$style3, _selectedShape$style4, _selectedShape$style5, _selectedShape$style6, _selectedShape$style7, _selectedShape$style8, _selectedShape$style9, _selectedShape$style$, _selectedShape$style10;
|
|
63
72
|
|
|
64
|
-
var
|
|
65
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
66
|
-
availableTools = _ref.availableTools,
|
|
67
|
-
updateToolSettings = _ref.updateToolSettings,
|
|
68
|
-
layersManipulation = _ref.layersManipulation,
|
|
69
|
-
toggleLayoutPanel = _ref.toggleLayoutPanel,
|
|
70
|
-
activeTool = _ref.activeTool,
|
|
73
|
+
var activeTool = _ref.activeTool,
|
|
71
74
|
selectedShape = _ref.selectedShape,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var handleShapeStyleChange = function handleShapeStyleChange(field, value) {
|
|
82
|
-
if (selectedShape) {
|
|
83
|
-
updateShape(_fp["default"].set(['style', field], value, selectedShape), true);
|
|
84
|
-
updateToolSettings(selectedShape.toolId, field, value);
|
|
85
|
-
} else {
|
|
86
|
-
updateToolSettings(activeTool.id, field, value);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
var handleShapeFontFamilyChange = function handleShapeFontFamilyChange(field, value) {
|
|
91
|
-
if (selectedShape) {
|
|
92
|
-
var _newShape$style$fontB, _newShape$style, _newShape$style$fontI, _newShape$style2, _newShape$style3;
|
|
93
|
-
|
|
94
|
-
var ctx = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d');
|
|
95
|
-
if (!ctx) return;
|
|
96
|
-
|
|
97
|
-
var newShape = _fp["default"].set(['style', field], value, selectedShape);
|
|
98
|
-
|
|
99
|
-
var fontSize = (0, _transform.calculateTextFontSize)(ctx, newShape.value, newShape.width, (_newShape$style$fontB = (_newShape$style = newShape.style) === null || _newShape$style === void 0 ? void 0 : _newShape$style.fontBold) !== null && _newShape$style$fontB !== void 0 ? _newShape$style$fontB : false, (_newShape$style$fontI = (_newShape$style2 = newShape.style) === null || _newShape$style2 === void 0 ? void 0 : _newShape$style2.fontItalic) !== null && _newShape$style$fontI !== void 0 ? _newShape$style$fontI : false, (_newShape$style3 = newShape.style) === null || _newShape$style3 === void 0 ? void 0 : _newShape$style3.fontFamily);
|
|
100
|
-
|
|
101
|
-
var resizedShape = _objectSpread(_objectSpread({}, newShape), {}, {
|
|
102
|
-
fontSize: fontSize,
|
|
103
|
-
height: fontSize * newShape.value.length
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
updateShape(resizedShape, true);
|
|
107
|
-
updateToolSettings(selectedShape.toolId, field, value);
|
|
108
|
-
} else {
|
|
109
|
-
updateToolSettings(activeTool.id, field, value);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
var handlePolygonLinesCount = function handlePolygonLinesCount(field, value) {
|
|
114
|
-
if (selectedShape) {
|
|
115
|
-
updateShape((0, _transform.updatePolygonLinesCount)(selectedShape, value), true);
|
|
116
|
-
updateToolSettings(selectedShape.toolId, field, value);
|
|
117
|
-
} else {
|
|
118
|
-
updateToolSettings(activeTool.id, field, value);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
var selectedShapeTool = selectedShape ? _fp["default"].find({
|
|
123
|
-
id: selectedShape.toolId
|
|
124
|
-
}, availableTools) || _fp["default"].find({
|
|
125
|
-
type: selectedShape.type
|
|
126
|
-
}, availableTools) : undefined;
|
|
127
|
-
return /*#__PURE__*/_react["default"].createElement(StyledSettingsBar, null, selectedShape ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, selectedShapeTool && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, 'strokeColor' in selectedShapeTool.settings && /*#__PURE__*/_react["default"].createElement(_ColorField["default"], {
|
|
75
|
+
selectedShapeTool = _ref.selectedShapeTool,
|
|
76
|
+
disabled = _ref.disabled,
|
|
77
|
+
selectedSettings = _ref.selectedSettings,
|
|
78
|
+
setSelectedSettings = _ref.setSelectedSettings,
|
|
79
|
+
handleShapeStyleChange = _ref.handleShapeStyleChange,
|
|
80
|
+
handlePolygonLinesCount = _ref.handlePolygonLinesCount,
|
|
81
|
+
handleShapeFontFamilyChange = _ref.handleShapeFontFamilyChange;
|
|
82
|
+
return selectedShape ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, selectedShapeTool && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, 'strokeColor' in selectedShapeTool.settings && /*#__PURE__*/_react["default"].createElement(_ColorField["default"], {
|
|
128
83
|
selectedSettings: selectedSettings,
|
|
129
84
|
setSelectedSettings: setSelectedSettings,
|
|
130
85
|
title: "Couleur du trait",
|
|
86
|
+
mode: "stroke",
|
|
131
87
|
disabled: disabled,
|
|
132
88
|
field: "strokeColor",
|
|
133
89
|
value: (_selectedShape$style = selectedShape.style) === null || _selectedShape$style === void 0 ? void 0 : _selectedShape$style.strokeColor,
|
|
@@ -146,6 +102,7 @@ var SettingsBar = function SettingsBar(_ref) {
|
|
|
146
102
|
selectedSettings: selectedSettings,
|
|
147
103
|
setSelectedSettings: setSelectedSettings,
|
|
148
104
|
title: "Epaisseur du trait",
|
|
105
|
+
icon: _icons.lineWidthIcon,
|
|
149
106
|
disabled: disabled,
|
|
150
107
|
field: "lineWidth",
|
|
151
108
|
value: (_selectedShape$style3 = selectedShape.style) === null || _selectedShape$style3 === void 0 ? void 0 : _selectedShape$style3.lineWidth,
|
|
@@ -204,6 +161,7 @@ var SettingsBar = function SettingsBar(_ref) {
|
|
|
204
161
|
selectedSettings: selectedSettings,
|
|
205
162
|
setSelectedSettings: setSelectedSettings,
|
|
206
163
|
title: "Opacit\xE9",
|
|
164
|
+
icon: _icons.opacityIcon,
|
|
207
165
|
min: selectedShapeTool.settings.opacity.min,
|
|
208
166
|
max: selectedShapeTool.settings.opacity.max,
|
|
209
167
|
step: selectedShapeTool.settings.opacity.step,
|
|
@@ -212,14 +170,11 @@ var SettingsBar = function SettingsBar(_ref) {
|
|
|
212
170
|
field: "globalAlpha",
|
|
213
171
|
value: (_selectedShape$style$ = (_selectedShape$style10 = selectedShape.style) === null || _selectedShape$style10 === void 0 ? void 0 : _selectedShape$style10.globalAlpha) !== null && _selectedShape$style$ !== void 0 ? _selectedShape$style$ : 100,
|
|
214
172
|
valueChanged: handleShapeStyleChange
|
|
215
|
-
})), /*#__PURE__*/_react["default"].createElement(
|
|
216
|
-
disabled: disabled,
|
|
217
|
-
selectedShape: selectedShape,
|
|
218
|
-
removeShape: removeShape
|
|
219
|
-
})) : 'settings' in activeTool && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, 'strokeColor' in activeTool.settings && /*#__PURE__*/_react["default"].createElement(_ColorField["default"], {
|
|
173
|
+
}))) : 'settings' in activeTool ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, 'strokeColor' in activeTool.settings && /*#__PURE__*/_react["default"].createElement(_ColorField["default"], {
|
|
220
174
|
selectedSettings: selectedSettings,
|
|
221
175
|
setSelectedSettings: setSelectedSettings,
|
|
222
176
|
title: "Couleur du trait",
|
|
177
|
+
mode: "stroke",
|
|
223
178
|
disabled: disabled,
|
|
224
179
|
field: "strokeColor",
|
|
225
180
|
value: activeTool.settings.strokeColor["default"],
|
|
@@ -240,6 +195,7 @@ var SettingsBar = function SettingsBar(_ref) {
|
|
|
240
195
|
title: "Epaisseur du trait",
|
|
241
196
|
disabled: disabled,
|
|
242
197
|
field: "lineWidth",
|
|
198
|
+
icon: _icons.lineWidthIcon,
|
|
243
199
|
value: activeTool.settings.lineWidth["default"],
|
|
244
200
|
valueChanged: handleShapeStyleChange,
|
|
245
201
|
unity: "px",
|
|
@@ -296,6 +252,7 @@ var SettingsBar = function SettingsBar(_ref) {
|
|
|
296
252
|
selectedSettings: selectedSettings,
|
|
297
253
|
setSelectedSettings: setSelectedSettings,
|
|
298
254
|
title: "Opacit\xE9",
|
|
255
|
+
icon: _icons.opacityIcon,
|
|
299
256
|
min: activeTool.settings.opacity.min,
|
|
300
257
|
max: activeTool.settings.opacity.max,
|
|
301
258
|
step: activeTool.settings.opacity.step,
|
|
@@ -304,11 +261,143 @@ var SettingsBar = function SettingsBar(_ref) {
|
|
|
304
261
|
field: "globalAlpha",
|
|
305
262
|
value: activeTool.settings.opacity["default"],
|
|
306
263
|
valueChanged: handleShapeStyleChange
|
|
307
|
-
}))
|
|
264
|
+
})) : null;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var SettingsBar = function SettingsBar(_ref2) {
|
|
268
|
+
var width = _ref2.width,
|
|
269
|
+
_ref2$disabled = _ref2.disabled,
|
|
270
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
|
|
271
|
+
availableTools = _ref2.availableTools,
|
|
272
|
+
updateToolSettings = _ref2.updateToolSettings,
|
|
273
|
+
layersManipulation = _ref2.layersManipulation,
|
|
274
|
+
toggleLayoutPanel = _ref2.toggleLayoutPanel,
|
|
275
|
+
activeTool = _ref2.activeTool,
|
|
276
|
+
selectedShape = _ref2.selectedShape,
|
|
277
|
+
canvas = _ref2.canvas,
|
|
278
|
+
updateShape = _ref2.updateShape,
|
|
279
|
+
removeShape = _ref2.removeShape;
|
|
280
|
+
|
|
281
|
+
var _useState = (0, _react.useState)(undefined),
|
|
282
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
283
|
+
selectedSettings = _useState2[0],
|
|
284
|
+
setSelectedSettings = _useState2[1];
|
|
285
|
+
|
|
286
|
+
var _useState3 = (0, _react.useState)(false),
|
|
287
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
288
|
+
isMenuOpen = _useState4[0],
|
|
289
|
+
setIsMenuOpen = _useState4[1];
|
|
290
|
+
|
|
291
|
+
var toggleTools = function toggleTools() {
|
|
292
|
+
setIsMenuOpen(function (prev) {
|
|
293
|
+
return !prev;
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
var selectedShapeTool = selectedShape ? _fp["default"].find({
|
|
298
|
+
id: selectedShape.toolId
|
|
299
|
+
}, availableTools) || _fp["default"].find({
|
|
300
|
+
type: selectedShape.type
|
|
301
|
+
}, availableTools) : undefined;
|
|
302
|
+
var nbSettingsTools = (selectedShapeTool ? _fp["default"].size(selectedShapeTool.settings) + 1 : 'settings' in activeTool ? _fp["default"].size(activeTool.settings) : 0) + (layersManipulation ? 1 : 0);
|
|
303
|
+
var settingsBreakpoint = nbSettingsTools * SETTING_WIDTH;
|
|
304
|
+
|
|
305
|
+
var _useState5 = (0, _react.useState)(width < settingsBreakpoint),
|
|
306
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
307
|
+
settingsInMenu = _useState6[0],
|
|
308
|
+
setSettingsInMenu = _useState6[1];
|
|
309
|
+
|
|
310
|
+
var handleShapeStyleChange = function handleShapeStyleChange(field, value) {
|
|
311
|
+
if (selectedShape) {
|
|
312
|
+
updateShape(_fp["default"].set(['style', field], value, selectedShape), true);
|
|
313
|
+
updateToolSettings(selectedShape.toolId, field, value);
|
|
314
|
+
} else {
|
|
315
|
+
updateToolSettings(activeTool.id, field, value);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
var handleShapeFontFamilyChange = function handleShapeFontFamilyChange(field, value) {
|
|
320
|
+
if (selectedShape) {
|
|
321
|
+
var _newShape$style$fontB, _newShape$style, _newShape$style$fontI, _newShape$style2, _newShape$style3;
|
|
322
|
+
|
|
323
|
+
var ctx = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d');
|
|
324
|
+
if (!ctx) return;
|
|
325
|
+
|
|
326
|
+
var newShape = _fp["default"].set(['style', field], value, selectedShape);
|
|
327
|
+
|
|
328
|
+
var fontSize = (0, _transform.calculateTextFontSize)(ctx, newShape.value, newShape.width, (_newShape$style$fontB = (_newShape$style = newShape.style) === null || _newShape$style === void 0 ? void 0 : _newShape$style.fontBold) !== null && _newShape$style$fontB !== void 0 ? _newShape$style$fontB : false, (_newShape$style$fontI = (_newShape$style2 = newShape.style) === null || _newShape$style2 === void 0 ? void 0 : _newShape$style2.fontItalic) !== null && _newShape$style$fontI !== void 0 ? _newShape$style$fontI : false, (_newShape$style3 = newShape.style) === null || _newShape$style3 === void 0 ? void 0 : _newShape$style3.fontFamily);
|
|
329
|
+
|
|
330
|
+
var resizedShape = _objectSpread(_objectSpread({}, newShape), {}, {
|
|
331
|
+
fontSize: fontSize,
|
|
332
|
+
height: fontSize * newShape.value.length
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
updateShape(resizedShape, true);
|
|
336
|
+
updateToolSettings(selectedShape.toolId, field, value);
|
|
337
|
+
} else {
|
|
338
|
+
updateToolSettings(activeTool.id, field, value);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
var handlePolygonLinesCount = function handlePolygonLinesCount(field, value) {
|
|
343
|
+
if (selectedShape) {
|
|
344
|
+
updateShape((0, _transform.updatePolygonLinesCount)(selectedShape, value), true);
|
|
345
|
+
updateToolSettings(selectedShape.toolId, field, value);
|
|
346
|
+
} else {
|
|
347
|
+
updateToolSettings(activeTool.id, field, value);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
(0, _react.useEffect)(function () {
|
|
352
|
+
setSettingsInMenu(width < settingsBreakpoint);
|
|
353
|
+
}, [width, settingsBreakpoint]);
|
|
354
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(StyledSettingsBar, null, settingsInMenu && nbSettingsTools > 2 && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
355
|
+
disabled: disabled,
|
|
356
|
+
onClick: toggleTools,
|
|
357
|
+
title: "Toggle settings",
|
|
358
|
+
icon: _icons.settingsIcon
|
|
359
|
+
}), selectedShape ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, selectedShapeTool && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !settingsInMenu && /*#__PURE__*/_react["default"].createElement(SettingsItems, {
|
|
360
|
+
activeTool: activeTool,
|
|
361
|
+
selectedShape: selectedShape,
|
|
362
|
+
selectedShapeTool: selectedShapeTool,
|
|
363
|
+
disabled: disabled,
|
|
364
|
+
selectedSettings: selectedSettings,
|
|
365
|
+
setSelectedSettings: setSelectedSettings,
|
|
366
|
+
handleShapeStyleChange: handleShapeStyleChange,
|
|
367
|
+
handlePolygonLinesCount: handlePolygonLinesCount,
|
|
368
|
+
handleShapeFontFamilyChange: handleShapeFontFamilyChange
|
|
369
|
+
}), /*#__PURE__*/_react["default"].createElement(_DeleteButton["default"], {
|
|
370
|
+
disabled: disabled,
|
|
371
|
+
selectedShape: selectedShape,
|
|
372
|
+
removeShape: removeShape
|
|
373
|
+
}))) : !settingsInMenu && /*#__PURE__*/_react["default"].createElement(SettingsItems, {
|
|
374
|
+
activeTool: activeTool,
|
|
375
|
+
selectedShape: selectedShape,
|
|
376
|
+
selectedShapeTool: selectedShapeTool,
|
|
377
|
+
disabled: disabled,
|
|
378
|
+
selectedSettings: selectedSettings,
|
|
379
|
+
setSelectedSettings: setSelectedSettings,
|
|
380
|
+
handleShapeStyleChange: handleShapeStyleChange,
|
|
381
|
+
handlePolygonLinesCount: handlePolygonLinesCount,
|
|
382
|
+
handleShapeFontFamilyChange: handleShapeFontFamilyChange
|
|
383
|
+
}), /*#__PURE__*/_react["default"].createElement(StyledSeparator, null), layersManipulation && /*#__PURE__*/_react["default"].createElement(_LayoutButton["default"], {
|
|
308
384
|
layersManipulation: layersManipulation,
|
|
309
385
|
disabled: disabled,
|
|
310
386
|
toggleLayoutPanel: toggleLayoutPanel
|
|
311
|
-
}))
|
|
387
|
+
})), isMenuOpen && /*#__PURE__*/_react["default"].createElement(StyledToolsModal, {
|
|
388
|
+
onClose: toggleTools,
|
|
389
|
+
position: "bottom"
|
|
390
|
+
}, /*#__PURE__*/_react["default"].createElement(SettingsItems, {
|
|
391
|
+
activeTool: activeTool,
|
|
392
|
+
selectedShape: selectedShape,
|
|
393
|
+
selectedShapeTool: selectedShapeTool,
|
|
394
|
+
disabled: disabled,
|
|
395
|
+
selectedSettings: selectedSettings,
|
|
396
|
+
setSelectedSettings: setSelectedSettings,
|
|
397
|
+
handleShapeStyleChange: handleShapeStyleChange,
|
|
398
|
+
handlePolygonLinesCount: handlePolygonLinesCount,
|
|
399
|
+
handleShapeFontFamilyChange: handleShapeFontFamilyChange
|
|
400
|
+
})));
|
|
312
401
|
};
|
|
313
402
|
|
|
314
403
|
var _default = SettingsBar;
|
|
@@ -74,8 +74,22 @@ var EditTextBox = function EditTextBox(_ref7) {
|
|
|
74
74
|
|
|
75
75
|
(0, _react.useEffect)(function () {
|
|
76
76
|
if (!ref.current) return;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
var currentNode = ref.current;
|
|
78
|
+
|
|
79
|
+
var handlePaste = function handlePaste(e) {
|
|
80
|
+
var _e$clipboardData;
|
|
81
|
+
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
var text = (_e$clipboardData = e.clipboardData) === null || _e$clipboardData === void 0 ? void 0 : _e$clipboardData.getData('text/plain');
|
|
84
|
+
document.execCommand('insertText', false, text); //TODO use Clipboard API when ready
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
currentNode.addEventListener('paste', handlePaste);
|
|
88
|
+
currentNode.innerHTML = (0, _string.convertStringArrayToDivContent)(defaultValue);
|
|
89
|
+
currentNode.focus();
|
|
90
|
+
return function () {
|
|
91
|
+
currentNode.removeEventListener('paste', handlePaste);
|
|
92
|
+
};
|
|
79
93
|
}, [defaultValue]);
|
|
80
94
|
var position = (0, _react.useMemo)(function () {
|
|
81
95
|
var _getShapeInfos = (0, _shapeData.getShapeInfos)(shape, selectionPadding),
|
|
@@ -18,7 +18,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
var LoadFileTool = function LoadFileTool(_ref) {
|
|
21
|
-
var _type$
|
|
21
|
+
var _type$label;
|
|
22
22
|
|
|
23
23
|
var _ref$disabled = _ref.disabled,
|
|
24
24
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
@@ -49,9 +49,9 @@ var LoadFileTool = function LoadFileTool(_ref) {
|
|
|
49
49
|
onClick: handleClick,
|
|
50
50
|
onChange: handleChange,
|
|
51
51
|
accept: accept,
|
|
52
|
-
title: (_type$
|
|
52
|
+
title: (_type$label = type.label) !== null && _type$label !== void 0 ? _type$label : type.type,
|
|
53
53
|
icon: img,
|
|
54
|
-
children: withText ? type.
|
|
54
|
+
children: withText ? type.label : undefined,
|
|
55
55
|
disabled: disabled
|
|
56
56
|
});
|
|
57
57
|
};
|
|
@@ -164,9 +164,7 @@ var MenuGroup = function MenuGroup(_ref) {
|
|
|
164
164
|
disabled: disabled || !hasActionToClear,
|
|
165
165
|
img: _tools.CLEAR_TOOL.icon,
|
|
166
166
|
isActive: activeTool.id === _tools.CLEAR_TOOL.id,
|
|
167
|
-
setActive:
|
|
168
|
-
return clearCanvas();
|
|
169
|
-
}
|
|
167
|
+
setActive: clearCanvas
|
|
170
168
|
}), (withUploadPicture || withUrlPicture || withLoadAndSave) && /*#__PURE__*/_react["default"].createElement("hr", null)), withUploadPicture && /*#__PURE__*/_react["default"].createElement(_LoadFileTool["default"], {
|
|
171
169
|
withText: true,
|
|
172
170
|
type: _tools.UPLOAD_PICTURE_TOOL,
|
|
@@ -12,7 +12,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _Button = _interopRequireDefault(require("../common/Button"));
|
|
13
13
|
|
|
14
14
|
var Tool = function Tool(_ref) {
|
|
15
|
-
var _type$
|
|
15
|
+
var _type$label;
|
|
16
16
|
|
|
17
17
|
var type = _ref.type,
|
|
18
18
|
img = _ref.img,
|
|
@@ -31,9 +31,9 @@ var Tool = function Tool(_ref) {
|
|
|
31
31
|
disabled: disabled,
|
|
32
32
|
selected: isActive,
|
|
33
33
|
onClick: handleClick,
|
|
34
|
-
title: (_type$
|
|
34
|
+
title: (_type$label = type.label) !== null && _type$label !== void 0 ? _type$label : type.type,
|
|
35
35
|
icon: img,
|
|
36
|
-
children: withText ? type.
|
|
36
|
+
children: withText ? type.label : undefined
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -143,8 +143,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
143
143
|
setActiveTool((_availableTools$find = availableTools.find(function (tool) {
|
|
144
144
|
return tool.id === toolId;
|
|
145
145
|
})) !== null && _availableTools$find !== void 0 ? _availableTools$find : activeTool);
|
|
146
|
-
};
|
|
147
|
-
|
|
146
|
+
};
|
|
148
147
|
|
|
149
148
|
(0, _react.useEffect)(function () {
|
|
150
149
|
setActionsInMenu(width < fullToolbarSize);
|
|
@@ -190,9 +189,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
190
189
|
disabled: disabled || !hasActionToClear,
|
|
191
190
|
img: _tools.CLEAR_TOOL.icon,
|
|
192
191
|
isActive: activeTool.id === _tools.CLEAR_TOOL.id,
|
|
193
|
-
setActive:
|
|
194
|
-
return clearCanvas();
|
|
195
|
-
}
|
|
192
|
+
setActive: clearCanvas
|
|
196
193
|
})), /*#__PURE__*/_react["default"].createElement(_MenuGroup["default"], {
|
|
197
194
|
withActionsInMenu: actionsInMenu,
|
|
198
195
|
disabled: disabled,
|
package/dist/constants/icons.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.visibilityOffIcon = exports.visibilityIcon = exports.unlockedIcon = exports.undoIcon = exports.trashIcon = exports.textIcon = exports.squareIcon = exports.shapesIcon = exports.
|
|
6
|
+
exports.visibilityOffIcon = exports.visibilityIcon = exports.unlockedIcon = exports.undoIcon = exports.trashIcon = exports.textIcon = exports.squareIcon = exports.shapesIcon = exports.settingsIcon = exports.saveIcon = exports.redoIcon = exports.recIcon = exports.publicIcon = exports.polygonIcon = exports.pictureIcon = exports.penIcon = exports.paletteIcon = exports.paintIcon = exports.openFileIcon = exports.opacityIcon = exports.noStrokeIcon = exports.noFillIcon = exports.menuIcon = exports.lockedIcon = exports.lineWidthIcon = exports.lineTypeIcon = exports.lineEndIcon = exports.layersIcon = exports.italicIcon = exports.gridOnIcon = exports.gridOffIcon = exports.fontIcon = exports.exportFileIcon = exports.encodedTransparentIcon = exports.ellipseIcon = exports.dotsIcon = exports.curveIcon = exports.cursorIcon = exports.clearIcon = exports.circleIcon = exports.brushIcon = exports.boldIcon = exports.arrowIcon = void 0;
|
|
7
7
|
var brushIcon = '<svg><path d="M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z"/></svg>';
|
|
8
8
|
exports.brushIcon = brushIcon;
|
|
9
9
|
var squareIcon = '<svg><path d="M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z"/></svg>';
|
|
@@ -32,7 +32,7 @@ var redoIcon = '<svg><path d="M8.292 15.833Q6.271 15.833 4.802 14.521Q3.333 13.2
|
|
|
32
32
|
exports.redoIcon = redoIcon;
|
|
33
33
|
var layersIcon = '<svg><path d="M10 17.646 2.438 11.75 3.875 10.646 10 15.396 16.125 10.646 17.562 11.75ZM10 13.188 2.5 7.354 10 1.521 17.5 7.354Z"/></svg>';
|
|
34
34
|
exports.layersIcon = layersIcon;
|
|
35
|
-
var clearIcon = '<svg><path d="
|
|
35
|
+
var clearIcon = '<svg><path d="M7.854 13.812 10 11.688 12.125 13.812 13.354 12.604 11.208 10.458 13.354 8.312 12.125 7.104 10 9.229 7.854 7.104 6.625 8.312 8.771 10.458 6.625 12.604ZM5.896 17.5Q5.167 17.5 4.656 16.99Q4.146 16.479 4.146 15.75V5.125H3.333V3.375H7.542V2.5H12.458V3.375H16.667V5.125H15.833V15.75Q15.833 16.479 15.323 16.99Q14.812 17.5 14.083 17.5Z"/></svg>';
|
|
36
36
|
exports.clearIcon = clearIcon;
|
|
37
37
|
var saveIcon = '<svg><path d="M17.5 5.833V15.75Q17.5 16.479 16.99 16.99Q16.479 17.5 15.75 17.5H4.25Q3.521 17.5 3.01 16.99Q2.5 16.479 2.5 15.75V4.25Q2.5 3.521 3.01 3.01Q3.521 2.5 4.25 2.5H14.167ZM10 14.917Q11.062 14.917 11.823 14.156Q12.583 13.396 12.583 12.333Q12.583 11.271 11.823 10.51Q11.062 9.75 10 9.75Q8.938 9.75 8.177 10.51Q7.417 11.271 7.417 12.333Q7.417 13.396 8.177 14.156Q8.938 14.917 10 14.917ZM5.021 8.396H12.521V5.021H5.021Z"/></svg>';
|
|
38
38
|
exports.saveIcon = saveIcon;
|
|
@@ -46,18 +46,16 @@ var textIcon = '<svg><path d="M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.29
|
|
|
46
46
|
exports.textIcon = textIcon;
|
|
47
47
|
var arrowIcon = '<svg><path d="M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z"/></svg>';
|
|
48
48
|
exports.arrowIcon = arrowIcon;
|
|
49
|
+
var cursorIcon = '<svg><path d="M8.0145 11.1707C8.38484 10.9914 8.82183 11.1558 8.99959 11.5295L10.7031 15.2591L12.0363 14.6238L10.3254 10.9017C10.1476 10.528 10.3106 10.0795 10.6809 9.90761L10.8883 9.84782L12.5918 9.51148L6.48133 4.33192V12.389L7.82934 11.2903L8.0145 11.1707ZM10.6587 16.9258C10.2883 17.1052 9.84395 16.9482 9.67359 16.5745L8.05894 13.0318L6.19988 14.5416C6.07396 14.6462 5.91842 14.706 5.74066 14.706C5.54423 14.706 5.35584 14.6272 5.21694 14.4871C5.07803 14.3469 5 14.1568 5 13.9586V2.74741C5 2.54919 5.07803 2.35908 5.21694 2.21891C5.35584 2.07874 5.54423 2 5.74066 2C5.91842 2 6.08878 2.06727 6.21469 2.1719L6.2221 2.16443L14.7323 9.36947C15.0508 9.63854 15.0879 10.1094 14.8286 10.4233C14.7175 10.5579 14.562 10.6475 14.4064 10.6774L12.0659 11.1408L13.6954 14.6761C13.888 15.0498 13.7102 15.4908 13.3399 15.6627L10.6587 16.9258Z"/></svg>';
|
|
50
|
+
exports.cursorIcon = cursorIcon;
|
|
49
51
|
var menuIcon = '<svg><path d="M2.5 15V13.25H17.5V15ZM2.5 10.875V9.125H17.5V10.875ZM2.5 6.75V5H17.5V6.75Z"/></svg>';
|
|
50
52
|
exports.menuIcon = menuIcon;
|
|
51
|
-
var dragIcon = '<svg><path d="M7.542 16.667Q6.833 16.667 6.333 16.167Q5.833 15.667 5.833 14.958Q5.833 14.25 6.333 13.75Q6.833 13.25 7.542 13.25Q8.25 13.25 8.75 13.75Q9.25 14.25 9.25 14.958Q9.25 15.667 8.75 16.167Q8.25 16.667 7.542 16.667ZM7.542 11.708Q6.833 11.708 6.333 11.208Q5.833 10.708 5.833 10Q5.833 9.292 6.333 8.792Q6.833 8.292 7.542 8.292Q8.25 8.292 8.75 8.792Q9.25 9.292 9.25 10Q9.25 10.708 8.75 11.208Q8.25 11.708 7.542 11.708ZM7.542 6.75Q6.833 6.75 6.333 6.25Q5.833 5.75 5.833 5.042Q5.833 4.333 6.333 3.833Q6.833 3.333 7.542 3.333Q8.25 3.333 8.75 3.833Q9.25 4.333 9.25 5.042Q9.25 5.75 8.75 6.25Q8.25 6.75 7.542 6.75ZM12.458 6.75Q11.75 6.75 11.25 6.25Q10.75 5.75 10.75 5.042Q10.75 4.333 11.25 3.833Q11.75 3.333 12.458 3.333Q13.167 3.333 13.667 3.833Q14.167 4.333 14.167 5.042Q14.167 5.75 13.667 6.25Q13.167 6.75 12.458 6.75ZM12.458 11.708Q11.75 11.708 11.25 11.208Q10.75 10.708 10.75 10Q10.75 9.292 11.25 8.792Q11.75 8.292 12.458 8.292Q13.167 8.292 13.667 8.792Q14.167 9.292 14.167 10Q14.167 10.708 13.667 11.208Q13.167 11.708 12.458 11.708ZM12.458 16.667Q11.75 16.667 11.25 16.167Q10.75 15.667 10.75 14.958Q10.75 14.25 11.25 13.75Q11.75 13.25 12.458 13.25Q13.167 13.25 13.667 13.75Q14.167 14.25 14.167 14.958Q14.167 15.667 13.667 16.167Q13.167 16.667 12.458 16.667Z"/></svg>';
|
|
52
|
-
exports.dragIcon = dragIcon;
|
|
53
53
|
var visibilityIcon = '<svg><path d="M10 13.354Q11.583 13.354 12.688 12.25Q13.792 11.146 13.792 9.562Q13.792 7.979 12.688 6.875Q11.583 5.771 10 5.771Q8.417 5.771 7.312 6.875Q6.208 7.979 6.208 9.562Q6.208 11.146 7.312 12.25Q8.417 13.354 10 13.354ZM10 11.812Q9.062 11.812 8.406 11.156Q7.75 10.5 7.75 9.562Q7.75 8.625 8.406 7.969Q9.062 7.312 10 7.312Q10.938 7.312 11.594 7.969Q12.25 8.625 12.25 9.562Q12.25 10.5 11.594 11.156Q10.938 11.812 10 11.812ZM10 15.833Q6.938 15.833 4.448 14.125Q1.958 12.417 0.833 9.562Q1.958 6.708 4.458 5.021Q6.958 3.333 10 3.333Q13.042 3.333 15.542 5.021Q18.042 6.708 19.167 9.562Q18.042 12.417 15.552 14.125Q13.062 15.833 10 15.833ZM10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562Q10 9.562 10 9.562ZM10 14.083Q12.333 14.083 14.281 12.865Q16.229 11.646 17.25 9.562Q16.229 7.479 14.281 6.281Q12.333 5.083 10 5.083Q7.667 5.083 5.708 6.281Q3.75 7.479 2.729 9.562Q3.75 11.646 5.708 12.865Q7.667 14.083 10 14.083Z"/></svg>';
|
|
54
54
|
exports.visibilityIcon = visibilityIcon;
|
|
55
55
|
var visibilityOffIcon = '<svg><path d="M13.521 11.021 12.25 9.75Q12.333 8.75 11.604 7.979Q10.875 7.208 9.812 7.312L8.542 6.042Q8.896 5.896 9.26 5.833Q9.625 5.771 10 5.771Q11.583 5.771 12.688 6.875Q13.792 7.979 13.792 9.562Q13.792 9.979 13.719 10.354Q13.646 10.729 13.521 11.021ZM16.167 13.646 14.917 12.417Q15.667 11.833 16.25 11.146Q16.833 10.458 17.25 9.562Q16.229 7.479 14.292 6.281Q12.354 5.083 10 5.083Q9.396 5.083 8.885 5.156Q8.375 5.229 7.875 5.375L6.5 4Q7.354 3.646 8.208 3.49Q9.062 3.333 10 3.333Q13.146 3.333 15.615 5.052Q18.083 6.771 19.167 9.562Q18.688 10.792 17.917 11.823Q17.146 12.854 16.167 13.646ZM16.396 18.854 12.938 15.396Q12.208 15.625 11.479 15.729Q10.75 15.833 10 15.833Q6.833 15.833 4.375 14.094Q1.917 12.354 0.833 9.562Q1.25 8.479 1.917 7.552Q2.583 6.625 3.417 5.875L1.125 3.562L2.375 2.354L17.625 17.625ZM4.604 7.062Q4.021 7.604 3.542 8.219Q3.062 8.833 2.729 9.562Q3.75 11.646 5.688 12.865Q7.625 14.083 10 14.083Q10.354 14.083 10.74 14.052Q11.125 14.021 11.479 13.938L10.812 13.271Q10.625 13.312 10.417 13.333Q10.208 13.354 10 13.354Q8.417 13.354 7.312 12.25Q6.208 11.146 6.208 9.562Q6.208 9.354 6.24 9.167Q6.271 8.979 6.312 8.771ZM11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875Q11.375 8.875 11.375 8.875ZM8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Q8.042 10.5 8.042 10.5Z"/></svg>';
|
|
56
56
|
exports.visibilityOffIcon = visibilityOffIcon;
|
|
57
57
|
var paletteIcon = '<svg><path d="M9.958 18.333Q8.25 18.333 6.74 17.677Q5.229 17.021 4.104 15.885Q2.979 14.75 2.323 13.229Q1.667 11.708 1.667 10Q1.667 8.271 2.333 6.75Q3 5.229 4.156 4.104Q5.312 2.979 6.854 2.323Q8.396 1.667 10.125 1.667Q11.771 1.667 13.26 2.25Q14.75 2.833 15.875 3.854Q17 4.875 17.667 6.26Q18.333 7.646 18.333 9.25Q18.333 11.688 16.792 12.948Q15.25 14.208 13.188 14.208H11.75Q11.625 14.208 11.562 14.281Q11.5 14.354 11.5 14.458Q11.5 14.688 11.812 15.219Q12.125 15.75 12.125 16.458Q12.125 17.458 11.51 17.896Q10.896 18.333 9.958 18.333ZM5.458 10.875Q6 10.875 6.375 10.5Q6.75 10.125 6.75 9.583Q6.75 9.042 6.375 8.667Q6 8.292 5.458 8.292Q4.917 8.292 4.542 8.667Q4.167 9.042 4.167 9.583Q4.167 10.125 4.542 10.5Q4.917 10.875 5.458 10.875ZM7.917 7.583Q8.458 7.583 8.833 7.208Q9.208 6.833 9.208 6.292Q9.208 5.75 8.833 5.375Q8.458 5 7.917 5Q7.375 5 7 5.375Q6.625 5.75 6.625 6.292Q6.625 6.833 7 7.208Q7.375 7.583 7.917 7.583ZM12.021 7.583Q12.562 7.583 12.938 7.208Q13.312 6.833 13.312 6.292Q13.312 5.75 12.938 5.375Q12.562 5 12.021 5Q11.479 5 11.104 5.375Q10.729 5.75 10.729 6.292Q10.729 6.833 11.104 7.208Q11.479 7.583 12.021 7.583ZM14.479 10.875Q15.021 10.875 15.396 10.5Q15.771 10.125 15.771 9.583Q15.771 9.042 15.396 8.667Q15.021 8.292 14.479 8.292Q13.938 8.292 13.562 8.667Q13.188 9.042 13.188 9.583Q13.188 10.125 13.562 10.5Q13.938 10.875 14.479 10.875Z"/></svg>';
|
|
58
58
|
exports.paletteIcon = paletteIcon;
|
|
59
|
-
var gestureIcon = '<svg><path d="M11.542 17.542Q10.417 17.542 9.625 16.75Q8.833 15.958 8.833 14.833Q8.833 14.083 9.135 13.365Q9.438 12.646 10.01 12.031Q10.583 11.417 11.396 10.979Q12.208 10.542 13.229 10.354Q13.188 9.646 12.885 9.323Q12.583 9 12.104 9Q11.479 9 10.76 9.521Q10.042 10.042 9.104 11.229Q7.792 12.896 6.906 13.552Q6.021 14.208 5.125 14.208Q4.062 14.208 3.302 13.458Q2.542 12.708 2.542 11.521Q2.542 10.521 3 9.406Q3.458 8.292 4.583 6.646Q5.021 6.021 5.219 5.656Q5.417 5.292 5.417 5.062Q5.417 4.938 5.375 4.885Q5.333 4.833 5.25 4.833Q5.042 4.833 4.74 5.104Q4.438 5.375 4.062 5.875L2.5 4.333Q3.188 3.396 3.948 3Q4.708 2.604 5.312 2.604Q6.271 2.604 6.958 3.313Q7.646 4.021 7.646 5.021Q7.646 5.625 7.323 6.344Q7 7.062 6.229 8.188Q5.438 9.375 5.094 10.135Q4.75 10.896 4.75 11.417Q4.75 11.708 4.844 11.854Q4.938 12 5.104 12Q5.396 12 5.927 11.49Q6.458 10.979 7.562 9.604Q8.167 8.875 8.729 8.344Q9.292 7.812 9.844 7.469Q10.396 7.125 10.958 6.958Q11.521 6.792 12.104 6.792Q13.604 6.792 14.458 7.781Q15.312 8.771 15.458 10.25H17.5V12.458H15.458Q15.312 14.479 14.323 16.01Q13.333 17.542 11.542 17.542ZM11.625 15.312Q12.271 15.312 12.656 14.531Q13.042 13.75 13.208 12.625Q12.188 12.896 11.625 13.531Q11.062 14.167 11.062 14.708Q11.062 14.979 11.219 15.146Q11.375 15.312 11.625 15.312Z"/></svg>';
|
|
60
|
-
exports.gestureIcon = gestureIcon;
|
|
61
59
|
var penIcon = '<svg><path d="M2.5 17.5V13.771L13.479 2.792Q14 2.271 14.719 2.271Q15.438 2.271 15.958 2.792L17.208 4.042Q17.708 4.542 17.708 5.281Q17.708 6.021 17.208 6.521L6.229 17.5ZM14.729 6.5 15.958 5.271 14.729 4.042 13.5 5.271Z"/></svg>';
|
|
62
60
|
exports.penIcon = penIcon;
|
|
63
61
|
var paintIcon = '<svg><path d="M9.167 18.333Q8.438 18.333 7.927 17.823Q7.417 17.312 7.417 16.583V13.438H5.083Q4.354 13.438 3.844 12.927Q3.333 12.417 3.333 11.688V5.938Q3.333 4.5 4.333 3.5Q5.333 2.5 6.75 2.5H16.667V11.688Q16.667 12.417 16.156 12.927Q15.646 13.438 14.917 13.438H12.542V16.583Q12.542 17.312 12.031 17.823Q11.521 18.333 10.792 18.333ZM5.083 8.312H14.917V4.25H14.125V7.562H12.375V4.25H11.667V5.917H9.917V4.25H6.75Q6.062 4.25 5.573 4.75Q5.083 5.25 5.083 5.938Z"/></svg>';
|
|
@@ -74,11 +72,23 @@ var gridOffIcon = '<svg><path d="M18.333 15.854 16.583 14.104V13.354H15.833L14.0
|
|
|
74
72
|
exports.gridOffIcon = gridOffIcon;
|
|
75
73
|
var ellipseIcon = '<svg><path d="M10 15.833Q7.917 15.833 6.667 14.177Q5.417 12.521 5.417 10Q5.417 7.479 6.667 5.823Q7.917 4.167 10 4.167Q12.083 4.167 13.333 5.823Q14.583 7.479 14.583 10Q14.583 12.521 13.333 14.177Q12.083 15.833 10 15.833ZM10 14.042Q11.375 14.042 12.021 12.833Q12.667 11.625 12.667 10Q12.667 8.375 12.021 7.167Q11.375 5.958 10 5.958Q8.625 5.958 7.979 7.167Q7.333 8.375 7.333 10Q7.333 11.625 7.979 12.833Q8.625 14.042 10 14.042Z"/></svg>';
|
|
76
74
|
exports.ellipseIcon = ellipseIcon;
|
|
77
|
-
var selectIcon = '<svg><path d="M8.854 17.5Q8.5 17.5 8.188 17.354Q7.875 17.208 7.604 16.958L3.271 12.646L4.5 11.375Q4.812 11.042 5.24 10.906Q5.667 10.771 6.104 10.875L7.479 11.188V4.667Q7.479 3.771 8.115 3.135Q8.75 2.5 9.646 2.5Q10.542 2.5 11.177 3.135Q11.812 3.771 11.812 4.667V8.062H12.188Q12.333 8.062 12.458 8.094Q12.583 8.125 12.708 8.188L15.812 9.708Q16.292 9.938 16.542 10.406Q16.792 10.875 16.688 11.417L15.917 16.042Q15.812 16.688 15.323 17.094Q14.833 17.5 14.167 17.5ZM8.854 15.75H14.167L14.958 11.229Q14.958 11.229 14.958 11.229Q14.958 11.229 14.958 11.229L11.5 9.562H10.062V4.667Q10.062 4.479 9.948 4.365Q9.833 4.25 9.646 4.25Q9.458 4.25 9.344 4.365Q9.229 4.479 9.229 4.667V13.333L5.708 12.604ZM8.854 15.75H9.229Q9.229 15.75 9.344 15.75Q9.458 15.75 9.646 15.75Q9.833 15.75 9.948 15.75Q10.062 15.75 10.062 15.75H11.521H14.167Q14.167 15.75 14.167 15.75Q14.167 15.75 14.167 15.75Z"/></svg>';
|
|
78
|
-
exports.selectIcon = selectIcon;
|
|
79
75
|
var curveIcon = '<svg><path d="M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z"/></svg>';
|
|
80
76
|
exports.curveIcon = curveIcon;
|
|
81
77
|
var boldIcon = '<svg><path d="M5.833 15V3.333H10.375Q11.812 3.333 12.885 4.156Q13.958 4.979 13.958 6.375Q13.958 7.375 13.49 7.969Q13.021 8.562 12.396 8.875V9.042Q13.312 9.354 13.844 10.021Q14.375 10.688 14.375 11.75Q14.375 13.312 13.229 14.156Q12.083 15 10.5 15ZM8.125 8.042H10.188Q10.854 8.042 11.302 7.656Q11.75 7.271 11.75 6.708Q11.75 6.167 11.302 5.771Q10.854 5.375 10.188 5.375H8.125ZM8.125 12.917H10.354Q11.167 12.917 11.625 12.51Q12.083 12.104 12.083 11.458Q12.083 10.812 11.625 10.406Q11.167 10 10.354 10H8.125Z"/></svg>';
|
|
82
78
|
exports.boldIcon = boldIcon;
|
|
83
79
|
var italicIcon = '<svg><path d="M4.167 16.667V14.083H6.979L10.229 5.917H7.5V3.333H15.833V5.917H13.021L9.771 14.083H12.5V16.667Z"/></svg>';
|
|
84
|
-
exports.italicIcon = italicIcon;
|
|
80
|
+
exports.italicIcon = italicIcon;
|
|
81
|
+
var lineWidthIcon = '<svg><path d="M3.021 16V15H17V16ZM3.021 13.5V12H17V13.5ZM3 10.5V8.5H16.979V10.5ZM3.021 7V4H17V7Z"/></svg>';
|
|
82
|
+
exports.lineWidthIcon = lineWidthIcon;
|
|
83
|
+
var lineTypeIcon = '<svg><path d="M3 16V14.5H4.5V16ZM6.125 16V14.5H7.625V16ZM9.25 16V14.5H10.75V16ZM12.375 16V14.5H13.875V16ZM15.5 16V14.5H17V16ZM3 13V11.5H6.5V13ZM8.25 13V11.5H11.75V13ZM13.5 13V11.5H17V13ZM3 10V8.5H9.25V10ZM10.75 10V8.5H17V10ZM3 7V4H17V7Z"/></svg>';
|
|
84
|
+
exports.lineTypeIcon = lineTypeIcon;
|
|
85
|
+
var fontIcon = '<svg><path d="M5.312 14.979H7.125L8.042 12.479H11.979L12.896 14.979H14.708L10.917 5H9.083ZM8.542 10.958 9.958 6.958H10.042L11.458 10.958ZM3.417 18.333Q2.688 18.333 2.177 17.823Q1.667 17.312 1.667 16.583V3.417Q1.667 2.688 2.177 2.177Q2.688 1.667 3.417 1.667H16.583Q17.312 1.667 17.823 2.177Q18.333 2.688 18.333 3.417V16.583Q18.333 17.312 17.823 17.823Q17.312 18.333 16.583 18.333ZM3.417 16.583H16.583Q16.583 16.583 16.583 16.583Q16.583 16.583 16.583 16.583V3.417Q16.583 3.417 16.583 3.417Q16.583 3.417 16.583 3.417H3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583ZM3.417 3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417V16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583Q3.417 16.583 3.417 16.583V3.417Q3.417 3.417 3.417 3.417Q3.417 3.417 3.417 3.417Z"/></svg>';
|
|
86
|
+
exports.fontIcon = fontIcon;
|
|
87
|
+
var lineEndIcon = '<svg><path d="M6 17 2 13 6 9 7.062 10.062 4.875 12.25H17V13.75H4.875L7.062 15.938ZM14 11 12.938 9.938 15.125 7.75H3V6.25H15.125L12.938 4.062L14 3L18 7Z"/></svg>';
|
|
88
|
+
exports.lineEndIcon = lineEndIcon;
|
|
89
|
+
var settingsIcon = '<svg><path d="M2.5 15.833V14.083H7.667V15.833ZM2.5 5.917V4.167H10.771V5.917ZM9.208 17.5V12.438H10.958V14.083H17.5V15.833H10.958V17.5ZM5.917 12.542V10.875H2.5V9.125H5.917V7.479H7.667V12.542ZM9.208 10.875V9.125H17.5V10.875ZM12.333 7.562V2.5H14.083V4.167H17.5V5.917H14.083V7.562Z"/></svg>';
|
|
90
|
+
exports.settingsIcon = settingsIcon;
|
|
91
|
+
var noStrokeIcon = '<svg><path d="M16.354 18.833 14.521 17Q13.542 17.646 12.396 17.99Q11.25 18.333 10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.729 2.01 7.594Q2.354 6.458 3 5.458L1.167 3.625L2.396 2.396L17.583 17.604ZM10 16.583Q10.896 16.583 11.708 16.365Q12.521 16.146 13.25 15.729L4.292 6.75Q3.875 7.479 3.646 8.292Q3.417 9.104 3.417 10Q3.417 12.729 5.344 14.656Q7.271 16.583 10 16.583ZM17 14.562 15.708 13.271Q16.125 12.542 16.354 11.719Q16.583 10.896 16.583 10Q16.583 7.271 14.656 5.344Q12.729 3.417 10 3.417Q9.104 3.417 8.292 3.646Q7.479 3.875 6.75 4.292L5.458 3Q6.458 2.354 7.594 2.01Q8.729 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.271 17.979 12.417Q17.625 13.562 17 14.562ZM11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771Q11.229 8.771 11.229 8.771ZM8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Q8.771 11.229 8.771 11.229Z"/></svg>';
|
|
92
|
+
exports.noStrokeIcon = noStrokeIcon;
|
|
93
|
+
var noFillIcon = '<svg ><path d="M16.354 18.833 14.521 17Q13.542 17.646 12.396 17.99Q11.25 18.333 10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.729 2.01 7.594Q2.354 6.458 3 5.458L1.167 3.625L2.396 2.396L17.583 17.604ZM17 14.562 5.458 3Q6.458 2.354 7.594 2.01Q8.729 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.271 17.979 12.417Q17.625 13.562 17 14.562Z"/></svg>';
|
|
94
|
+
exports.noFillIcon = noFillIcon;
|
package/dist/constants/style.js
CHANGED
|
@@ -14,7 +14,7 @@ var STYLE_LINE_DASH = [0, 1, 2];
|
|
|
14
14
|
exports.STYLE_LINE_DASH = STYLE_LINE_DASH;
|
|
15
15
|
var STYLE_LINE_WITH_ARROW = [0, 1, 2, 3];
|
|
16
16
|
exports.STYLE_LINE_WITH_ARROW = STYLE_LINE_WITH_ARROW;
|
|
17
|
-
var LINE_DASH_DATA = [[1, 0], [
|
|
17
|
+
var LINE_DASH_DATA = [[1, 0], [1, 2], [4, 6]];
|
|
18
18
|
exports.LINE_DASH_DATA = LINE_DASH_DATA;
|
|
19
19
|
var STYLE_FONTS = ['arial', 'serif', 'monospace'];
|
|
20
20
|
exports.STYLE_FONTS = STYLE_FONTS;
|
package/dist/constants/tools.js
CHANGED
|
@@ -276,7 +276,7 @@ var DEFAULT_SHAPE_PICTURE = {
|
|
|
276
276
|
type: _Shapes.ShapeEnum.picture,
|
|
277
277
|
id: "".concat(PREFIX_ID, "picture"),
|
|
278
278
|
icon: _icons.pictureIcon,
|
|
279
|
-
|
|
279
|
+
label: 'Image',
|
|
280
280
|
settings: SETTINGS_DEFAULT_PICTURE
|
|
281
281
|
};
|
|
282
282
|
exports.DEFAULT_SHAPE_PICTURE = DEFAULT_SHAPE_PICTURE;
|
|
@@ -284,7 +284,7 @@ var DEFAULT_SHAPE_BRUSH = {
|
|
|
284
284
|
type: _Shapes.ShapeEnum.brush,
|
|
285
285
|
id: "".concat(PREFIX_ID, "brush"),
|
|
286
286
|
icon: _icons.brushIcon,
|
|
287
|
-
|
|
287
|
+
label: 'Brosse',
|
|
288
288
|
settings: SETTINGS_DEFAULT_BRUSH
|
|
289
289
|
};
|
|
290
290
|
exports.DEFAULT_SHAPE_BRUSH = DEFAULT_SHAPE_BRUSH;
|
|
@@ -292,7 +292,7 @@ var DEFAULT_SHAPE_LINE = {
|
|
|
292
292
|
type: _Shapes.ShapeEnum.line,
|
|
293
293
|
id: "".concat(PREFIX_ID, "line"),
|
|
294
294
|
icon: _icons.arrowIcon,
|
|
295
|
-
|
|
295
|
+
label: 'Ligne',
|
|
296
296
|
settings: SETTINGS_DEFAULT_LINE
|
|
297
297
|
};
|
|
298
298
|
exports.DEFAULT_SHAPE_LINE = DEFAULT_SHAPE_LINE;
|
|
@@ -300,7 +300,7 @@ var DEFAULT_SHAPE_POLYGON = {
|
|
|
300
300
|
type: _Shapes.ShapeEnum.polygon,
|
|
301
301
|
id: "".concat(PREFIX_ID, "polygon"),
|
|
302
302
|
icon: _icons.polygonIcon,
|
|
303
|
-
|
|
303
|
+
label: 'Polygone',
|
|
304
304
|
settings: SETTINGS_DEFAULT_POLYGON
|
|
305
305
|
};
|
|
306
306
|
exports.DEFAULT_SHAPE_POLYGON = DEFAULT_SHAPE_POLYGON;
|
|
@@ -308,7 +308,7 @@ var DEFAULT_SHAPE_CURVE = {
|
|
|
308
308
|
type: _Shapes.ShapeEnum.curve,
|
|
309
309
|
id: "".concat(PREFIX_ID, "curve"),
|
|
310
310
|
icon: _icons.curveIcon,
|
|
311
|
-
|
|
311
|
+
label: 'Courbe',
|
|
312
312
|
settings: SETTINGS_DEFAULT_CURVE
|
|
313
313
|
};
|
|
314
314
|
exports.DEFAULT_SHAPE_CURVE = DEFAULT_SHAPE_CURVE;
|
|
@@ -317,7 +317,7 @@ var DEFAULT_SHAPE_RECT = {
|
|
|
317
317
|
id: "".concat(PREFIX_ID, "rect"),
|
|
318
318
|
icon: _icons.squareIcon,
|
|
319
319
|
// temporary
|
|
320
|
-
|
|
320
|
+
label: 'Rectangle',
|
|
321
321
|
settings: SETTINGS_DEFAULT_RECT
|
|
322
322
|
};
|
|
323
323
|
exports.DEFAULT_SHAPE_RECT = DEFAULT_SHAPE_RECT;
|
|
@@ -325,7 +325,7 @@ var DEFAULT_SHAPE_SQUARE = {
|
|
|
325
325
|
type: _Shapes.ShapeEnum.square,
|
|
326
326
|
id: "".concat(PREFIX_ID, "square"),
|
|
327
327
|
icon: _icons.squareIcon,
|
|
328
|
-
|
|
328
|
+
label: 'Carré',
|
|
329
329
|
settings: SETTINGS_DEFAULT_SQUARE
|
|
330
330
|
};
|
|
331
331
|
exports.DEFAULT_SHAPE_SQUARE = DEFAULT_SHAPE_SQUARE;
|
|
@@ -333,7 +333,7 @@ var DEFAULT_SHAPE_CIRCLE = {
|
|
|
333
333
|
type: _Shapes.ShapeEnum.circle,
|
|
334
334
|
id: "".concat(PREFIX_ID, "circle"),
|
|
335
335
|
icon: _icons.circleIcon,
|
|
336
|
-
|
|
336
|
+
label: 'Cercle',
|
|
337
337
|
settings: SETTINGS_DEFAULT_CIRCLE
|
|
338
338
|
};
|
|
339
339
|
exports.DEFAULT_SHAPE_CIRCLE = DEFAULT_SHAPE_CIRCLE;
|
|
@@ -342,7 +342,7 @@ var DEFAULT_SHAPE_ELLIPSE = {
|
|
|
342
342
|
id: "".concat(PREFIX_ID, "ellipse"),
|
|
343
343
|
icon: _icons.circleIcon,
|
|
344
344
|
// temporary
|
|
345
|
-
|
|
345
|
+
label: 'Ellipse',
|
|
346
346
|
settings: SETTINGS_DEFAULT_ELLIPSE
|
|
347
347
|
};
|
|
348
348
|
exports.DEFAULT_SHAPE_ELLIPSE = DEFAULT_SHAPE_ELLIPSE;
|
|
@@ -350,7 +350,7 @@ var DEFAULT_SHAPE_TEXT = {
|
|
|
350
350
|
type: _Shapes.ShapeEnum.text,
|
|
351
351
|
id: "".concat(PREFIX_ID, "text"),
|
|
352
352
|
icon: _icons.textIcon,
|
|
353
|
-
|
|
353
|
+
label: 'Texte',
|
|
354
354
|
settings: SETTINGS_DEFAULT_TEXT
|
|
355
355
|
};
|
|
356
356
|
exports.DEFAULT_SHAPE_TEXT = DEFAULT_SHAPE_TEXT;
|
|
@@ -359,70 +359,70 @@ exports.DEFAULT_SHAPE_TOOLS = DEFAULT_SHAPE_TOOLS;
|
|
|
359
359
|
var SELECTION_TOOL = {
|
|
360
360
|
id: "".concat(PREFIX_ID, "selection"),
|
|
361
361
|
type: _tools.ActionsEnum.selection,
|
|
362
|
-
icon: _icons.
|
|
363
|
-
|
|
362
|
+
icon: _icons.cursorIcon,
|
|
363
|
+
label: 'Sélection'
|
|
364
364
|
};
|
|
365
365
|
exports.SELECTION_TOOL = SELECTION_TOOL;
|
|
366
366
|
var UNDO_TOOL = {
|
|
367
367
|
id: "".concat(PREFIX_ID, "undo"),
|
|
368
368
|
type: _tools.ActionsEnum.undo,
|
|
369
369
|
icon: _icons.undoIcon,
|
|
370
|
-
|
|
370
|
+
label: 'Undo'
|
|
371
371
|
};
|
|
372
372
|
exports.UNDO_TOOL = UNDO_TOOL;
|
|
373
373
|
var REDO_TOOL = {
|
|
374
374
|
id: "".concat(PREFIX_ID, "redo"),
|
|
375
375
|
type: _tools.ActionsEnum.redo,
|
|
376
376
|
icon: _icons.redoIcon,
|
|
377
|
-
|
|
377
|
+
label: 'Redo'
|
|
378
378
|
};
|
|
379
379
|
exports.REDO_TOOL = REDO_TOOL;
|
|
380
380
|
var CLEAR_TOOL = {
|
|
381
381
|
id: "".concat(PREFIX_ID, "clear"),
|
|
382
382
|
type: _tools.ActionsEnum.clear,
|
|
383
383
|
icon: _icons.clearIcon,
|
|
384
|
-
|
|
384
|
+
label: 'Clear'
|
|
385
385
|
};
|
|
386
386
|
exports.CLEAR_TOOL = CLEAR_TOOL;
|
|
387
387
|
var EXPORT_TOOL = {
|
|
388
388
|
id: "".concat(PREFIX_ID, "export"),
|
|
389
389
|
type: _tools.ActionsEnum["export"],
|
|
390
390
|
icon: _icons.exportFileIcon,
|
|
391
|
-
|
|
391
|
+
label: 'Export PNG'
|
|
392
392
|
};
|
|
393
393
|
exports.EXPORT_TOOL = EXPORT_TOOL;
|
|
394
394
|
var LOAD_TOOL = {
|
|
395
395
|
id: "".concat(PREFIX_ID, "load"),
|
|
396
396
|
type: _tools.ActionsEnum.loadFile,
|
|
397
397
|
icon: _icons.openFileIcon,
|
|
398
|
-
|
|
398
|
+
label: 'Load project'
|
|
399
399
|
};
|
|
400
400
|
exports.LOAD_TOOL = LOAD_TOOL;
|
|
401
401
|
var SAVE_TOOL = {
|
|
402
402
|
id: "".concat(PREFIX_ID, "save"),
|
|
403
403
|
type: _tools.ActionsEnum.saveFile,
|
|
404
404
|
icon: _icons.saveIcon,
|
|
405
|
-
|
|
405
|
+
label: 'Save project'
|
|
406
406
|
};
|
|
407
407
|
exports.SAVE_TOOL = SAVE_TOOL;
|
|
408
408
|
var MOVE_TOOL = {
|
|
409
409
|
id: "".concat(PREFIX_ID, "move"),
|
|
410
410
|
type: _tools.ActionsEnum.move,
|
|
411
|
-
icon: _icons.
|
|
412
|
-
|
|
411
|
+
icon: _icons.cursorIcon,
|
|
412
|
+
label: 'Move'
|
|
413
413
|
};
|
|
414
414
|
exports.MOVE_TOOL = MOVE_TOOL;
|
|
415
415
|
var UPLOAD_PICTURE_TOOL = {
|
|
416
416
|
id: "".concat(PREFIX_ID, "upload-picture"),
|
|
417
417
|
type: _tools.ActionsEnum.uploadPicture,
|
|
418
418
|
icon: _icons.pictureIcon,
|
|
419
|
-
|
|
419
|
+
label: 'Upload picture'
|
|
420
420
|
};
|
|
421
421
|
exports.UPLOAD_PICTURE_TOOL = UPLOAD_PICTURE_TOOL;
|
|
422
422
|
var ADD_URL_PICTURE_TOOL = {
|
|
423
423
|
id: "".concat(PREFIX_ID, "upload-picture"),
|
|
424
424
|
type: _tools.ActionsEnum.addUrlPicture,
|
|
425
425
|
icon: _icons.pictureIcon,
|
|
426
|
-
|
|
426
|
+
label: 'Add picture from URL'
|
|
427
427
|
};
|
|
428
428
|
exports.ADD_URL_PICTURE_TOOL = ADD_URL_PICTURE_TOOL;
|
package/dist/styles.css
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
min-width: 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.s1unz6yq{position:absolute;display:inline-block;outline:none;left:0px;top:0px;-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top;box-sizing:border-box;-webkit-transform:var(--s1unz6yq-0);-ms-transform:var(--s1unz6yq-0);transform:var(--s1unz6yq-0);color:var(--s1unz6yq-1);padding:var(--s1unz6yq-2);font-size:var(--s1unz6yq-3);line-height:var(--s1unz6yq-3);font-family:var(--s1unz6yq-5);opacity:var(--s1unz6yq-6);}.s1unz6yq[data-fontbold='true']{font-weight:bold;}.s1unz6yq[data-fontitalic='true']{font-style:italic;}
|
|
34
|
+
.s1unz6yq{position:absolute;display:inline-block;outline:none;left:0px;top:0px;-webkit-transform-origin:left top;-ms-transform-origin:left top;transform-origin:left top;box-sizing:border-box;-webkit-transform:var(--s1unz6yq-0);-ms-transform:var(--s1unz6yq-0);transform:var(--s1unz6yq-0);color:var(--s1unz6yq-1);padding:var(--s1unz6yq-2);font-size:var(--s1unz6yq-3);line-height:var(--s1unz6yq-3);font-family:var(--s1unz6yq-5);opacity:var(--s1unz6yq-6);width:-webkit-max-content;width:-moz-max-content;width:max-content;}.s1unz6yq[data-fontbold='true']{font-weight:bold;}.s1unz6yq[data-fontitalic='true']{font-style:italic;}
|
|
35
35
|
.s9czb9p{-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}
|
|
36
36
|
.s1538eht{position:relative;background-color:var(--canvas-bg);background-repeat:repeat;background-size:16px;overflow:hidden;display:grid;}.s1538eht[data-grid='true']{background-image:url("data:image/svg+xml,%3Csvg%20id%3D%22svg%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%22400%22%20height%3D%22400%22%20viewBox%3D%220%2C%200%2C%20400%2C400%22%3E%3Cg%20id%3D%22svgg%22%3E%3Cpath%20id%3D%22path0%22%20d%3D%22M204.800%2094.600%20C%20204.800%20188.933%2C204.802%20189.200%2C205.600%20189.200%20C%20206.248%20189.200%2C206.400%20189.467%2C206.400%20190.600%20C%20206.400%20191.733%2C206.552%20192.000%2C207.200%20192.000%20C%20207.733%20192.000%2C208.000%20192.267%2C208.000%20192.800%20C%20208.000%20193.244%2C208.267%20193.600%2C208.600%20193.600%20C%20208.933%20193.600%2C209.200%20193.956%2C209.200%20194.400%20C%20209.200%20195.067%2C209.467%20195.200%2C210.800%20195.200%20C%20212.133%20195.200%2C212.400%20195.333%2C212.400%20196.000%20C%20212.400%20196.798%2C212.667%20196.800%2C306.200%20196.800%20L%20400.000%20196.800%20400.000%2098.400%20L%20400.000%200.000%20302.400%200.000%20L%20204.800%200.000%20204.800%2094.600%20M0.000%20302.400%20L%200.000%20400.000%2098.400%20400.000%20L%20196.800%20400.000%20196.800%20306.200%20C%20196.800%20212.667%2C196.798%20212.400%2C196.000%20212.400%20C%20195.333%20212.400%2C195.200%20212.133%2C195.200%20210.800%20C%20195.200%20209.467%2C195.067%20209.200%2C194.400%20209.200%20C%20193.956%20209.200%2C193.600%20208.933%2C193.600%20208.600%20C%20193.600%20208.267%2C193.244%20208.000%2C192.800%20208.000%20C%20192.267%20208.000%2C192.000%20207.733%2C192.000%20207.200%20C%20192.000%20206.552%2C191.733%20206.400%2C190.600%20206.400%20C%20189.467%20206.400%2C189.200%20206.248%2C189.200%20205.600%20C%20189.200%20204.802%2C188.933%20204.800%2C94.600%20204.800%20L%200.000%20204.800%200.000%20302.400%20%22%20stroke%3D%22none%22%20fill%3D%22%23fcfcfc%22%20fill-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3Cpath%20id%3D%22path1%22%20d%3D%22M0.000%20100.000%20L%200.000%20200.000%2096.800%20200.000%20C%20193.333%20200.000%2C193.600%20199.998%2C193.600%20199.200%20C%20193.600%20198.533%2C193.867%20198.400%2C195.200%20198.400%20C%20196.533%20198.400%2C196.800%20198.267%2C196.800%20197.600%20C%20196.800%20197.067%2C197.067%20196.800%2C197.600%20196.800%20C%20198.267%20196.800%2C198.400%20196.533%2C198.400%20195.200%20C%20198.400%20193.867%2C198.533%20193.600%2C199.200%20193.600%20C%20199.998%20193.600%2C200.000%20193.333%2C200.000%2096.800%20L%20200.000%200.000%20100.000%200.000%20L%200.000%200.000%200.000%20100.000%20M208.000%20202.400%20C%20208.000%20203.067%2C207.733%20203.200%2C206.400%20203.200%20C%20205.067%20203.200%2C204.800%20203.333%2C204.800%20204.000%20C%20204.800%20204.533%2C204.533%20204.800%2C204.000%20204.800%20C%20203.333%20204.800%2C203.200%20205.067%2C203.200%20206.400%20C%20203.200%20207.733%2C203.067%20208.000%2C202.400%20208.000%20C%20201.602%20208.000%2C201.600%20208.267%2C201.600%20304.000%20L%20201.600%20400.000%20300.800%20400.000%20L%20400.000%20400.000%20400.000%20300.800%20L%20400.000%20201.600%20304.000%20201.600%20C%20208.267%20201.600%2C208.000%20201.602%2C208.000%20202.400%20%22%20stroke%3D%22none%22%20fill%3D%22%23e4e4e4%22%20fill-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3Cpath%20id%3D%22path2%22%20d%3D%22%22%20stroke%3D%22none%22%20fill%3D%22%23f4100f0%22%20fill-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3Cpath%20id%3D%22path3%22%20d%3D%22%22%20stroke%3D%22none%22%20fill%3D%22%23f4100f0%22%20fill-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3Cpath%20id%3D%22path4%22%20d%3D%22%22%20stroke%3D%22none%22%20fill%3D%22%23f4100f0%22%20fill-rule%3D%22evenodd%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fsvg%3E");}.s1538eht[data-grow='true']{width:100%;height:100%;}
|
|
37
37
|
.s101qxdc{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-width:100%;touch-action:none;display:block;grid-area:1 / 1;}.s101qxdc[data-grow='true']{width:100%;}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
.sst453j{width:100%;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:2px 6px;}
|
|
41
41
|
.s1q5lsc2{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
|
|
42
42
|
.s1dis2j8{-webkit-flex:1;-ms-flex:1;flex:1;text-align:left;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.s1dis2j8 + .s1q5lsc2{margin-left:12px;}
|
|
43
|
-
.s1xzg253{position:absolute;z-index:3;background:var(--toolbar-bg);bottom:100%;box-shadow:0 3px 8px rgb(0 0 0 / 24%);padding:8px;border-radius:8px;white-space:nowrap;}.s1xzg253[data-alignment='left']{left:0;margin:4px;}.s1xzg253[data-alignment='center']{left:50%;-webkit-transform:translate3d(-50%,0px,0px);-ms-transform:translate3d(-50%,0px,0px);transform:translate3d(-50%,0px,0px);margin:4px 0px;}.s1xzg253[data-alignment='right']{right:0;margin:4px;}
|
|
43
|
+
.s1xzg253{position:absolute;z-index:3;background:var(--toolbar-bg);bottom:100%;box-shadow:0 3px 8px rgb(0 0 0 / 24%);padding:8px;border-radius:8px;white-space:nowrap;box-sizing:border-box;}.s1xzg253[data-alignment='left']{left:0;margin:4px;}.s1xzg253[data-alignment='center']{left:50%;-webkit-transform:translate3d(-50%,0px,0px);-ms-transform:translate3d(-50%,0px,0px);transform:translate3d(-50%,0px,0px);margin:4px 0px;}.s1xzg253[data-alignment='right']{right:0;margin:4px;}.s1xzg253[data-fitcontainer='true']{max-width:100%;}
|
|
44
44
|
.s17qj3jh{margin-bottom:8px;margin-top:4px;font-size:18px;}
|
|
45
45
|
.su3a8bs{display:inline-block;background:var(--toolbar-bg);box-sizing:border-box;overflow-y:auto;min-width:200px;}
|
|
46
46
|
.szboplp{margin:2px 0;}.szboplp:not(:hover){opacity:0.2;}
|
|
@@ -56,26 +56,29 @@
|
|
|
56
56
|
.siejlch{position:relative;display:inline-block;}
|
|
57
57
|
.s1uphjfh{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;bottom:unset;top:100%;}.s1uphjfh[data-vertical='1']{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
|
|
58
58
|
.s1e5a6k5{position:relative;display:inline-block;}
|
|
59
|
-
.s1c8tp02{z-index:3;position:absolute;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;left:0;right:0;bottom:0;top:0;}
|
|
60
|
-
.svkxpz4{display:grid;background:var(--toolbar-bg);box-shadow:0 3px 8px rgb(0 0 0 / 24%);padding:
|
|
59
|
+
.s1c8tp02{z-index:3;position:absolute;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;left:0;right:0;bottom:0;top:0;}.s1c8tp02[data-position='center']{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.s1c8tp02[data-position='bottom']{-webkit-align-items:end;-webkit-box-align:end;-ms-flex-align:end;align-items:end;}
|
|
60
|
+
.svkxpz4{display:grid;background:var(--toolbar-bg);box-shadow:0 3px 8px rgb(0 0 0 / 24%);padding:4px;border-radius:8px;white-space:nowrap;position:relative;}
|
|
61
61
|
.s1s9jyyg{position:absolute;left:0;top:0;right:0;bottom:0;background:#00000073;}
|
|
62
62
|
.s95bkm9 form{grid-template-columns:3fr 1fr 1fr;}.s95bkm9 form input{color:var(--font-color);border:1px solid var(--font-color);background:var(--toolbar-bg);outline:none;}
|
|
63
63
|
.so6hnjf{-webkit-flex:1;-ms-flex:1;flex:1;position:relative;height:100%;text-align:center;height:36px;}
|
|
64
64
|
.s1c1dllr{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;max-height:36px;background:var(--toolbar-bg);border-bottom:1px solid var(--divider-color);box-sizing:border-box;}
|
|
65
65
|
.s1g032mh{grid-template-columns:1fr 1fr 1fr;}
|
|
66
|
-
.snh2jyk{width:
|
|
67
|
-
.sfm1cqx{
|
|
66
|
+
.snh2jyk{width:20px;height:20px;box-sizing:border-box;border-radius:50%;}.snh2jyk[data-mode='fill']{border:1px solid #80808038;background:var(--snh2jyk-0);}.snh2jyk[data-mode='stroke']{border:4px solid #80808038;}.snh2jyk[data-mode='stroke']:after{content:'';display:block;border-radius:100%;border:2px solid var(--snh2jyk-0);position:relative;width:18px;height:18px;left:-3px;top:-3px;box-sizing:border-box;}
|
|
67
|
+
.sfm1cqx{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}
|
|
68
|
+
.sttf061{width:20px;height:20px;box-sizing:border-box;border-radius:50%;color:var(--sttf061-0);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:baseline;-webkit-box-align:baseline;-ms-flex-align:baseline;align-items:baseline;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-weight:bold;}
|
|
68
69
|
.layoutPanelOpened .sj7hhjx.sj7hhjx{color:var(--font-selected-color);background:var(--font-selected-bg);}.sj7hhjx[data-hidden='1']{display:none;}
|
|
69
|
-
.s9mugpt{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
|
|
70
|
+
.s9mugpt{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}
|
|
70
71
|
.s1ktxhkr{padding:16px;}
|
|
72
|
+
.s5sp14o{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}
|
|
71
73
|
.smpmxx5{font-family:var(--smpmxx5-0);}
|
|
72
74
|
.s1qssg4n{display:inline-block;width:6px;height:2px;background:transparent;vertical-align:middle;}
|
|
73
|
-
.se26iq6{display:inline-block;}.se26iq6[data-type='0'] .s1qssg4n{background:currentColor;}.se26iq6[data-type='
|
|
75
|
+
.se26iq6{display:inline-block;}.se26iq6[data-type='0'] .s1qssg4n{background:currentColor;}.se26iq6[data-type='2']{position:relative;left:3px;}.se26iq6[data-type='2'] .s1qssg4n:nth-child(3n-1){background:currentColor;width:12px;}.se26iq6[data-type='2'] .s1qssg4n:nth-child(n+11){display:none;}.se26iq6[data-type='1'] .s1qssg4n:nth-child(2n+1){background:currentColor;}
|
|
74
76
|
.s1xxj4yl{position:absolute;left:0;top:50%;-webkit-transform:translate3d(-25%,-50%,0px);-ms-transform:translate3d(-25%,-50%,0px);transform:translate3d(-25%,-50%,0px);display:inline-block;width:0;height:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:15px solid currentColor;}
|
|
75
77
|
.sbd6jc8{position:absolute;right:0;top:50%;-webkit-transform:translate3d(25%,-50%,0px);-ms-transform:translate3d(25%,-50%,0px);transform:translate3d(25%,-50%,0px);display:inline-block;width:0;height:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:15px solid currentColor;}
|
|
76
78
|
.scawaat{position:relative;display:inline-block;width:60px;height:2px;background:currentColor;vertical-align:middle;}.scawaat[data-type='0'] .s1xxj4yl,.scawaat[data-type='1'] .s1xxj4yl{display:none;}.scawaat[data-type='0'] .sbd6jc8,.scawaat[data-type='2'] .sbd6jc8{display:none;}
|
|
77
79
|
.s16z54di{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;background:var(--toolbar-bg);position:relative;height:36px;border-top:1px solid var(--divider-color);box-sizing:border-box;}
|
|
78
80
|
.sa7lzh9{-webkit-flex:1;-ms-flex:1;flex:1;}
|
|
81
|
+
.s7b85in{grid-template-columns:repeat(auto-fill,40px);width:100%;}
|
|
79
82
|
.s1xssqat{display:inline-block;padding:12px 48px;margin:4px;max-width:calc(100% - 24px);overflow-wrap:break-word;box-sizing:border-box;-webkit-transition:all 500ms;transition:all 500ms;opacity:0;-webkit-transform:translate3d(0px,40px,0px);-ms-transform:translate3d(0px,40px,0px);transform:translate3d(0px,40px,0px);}.s1xssqat[data-type='0']{background:#646464;color:white;}.s1xssqat[data-type='1']{background:#c3a200;color:black;}.s1xssqat[data-type='2']{background:#911717;color:white;}.s1xssqat[data-type='3']{background:#088900;color:white;}.s1xssqat[data-is-shown='1']{opacity:1;-webkit-transform:translate3d(0px,0px,0px);-ms-transform:translate3d(0px,0px,0px);transform:translate3d(0px,0px,0px);}.s1xssqat[data-is-shown='0']{opacity:0;-webkit-transform:translate3d(0px,40px,0px);-ms-transform:translate3d(0px,40px,0px);transform:translate3d(0px,40px,0px);}
|
|
80
83
|
.s1bgtt22{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;position:absolute;z-index:4;bottom:0;left:0;right:0;height:0px;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
|
|
81
84
|
.s9j48u3{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;position:absolute;z-index:2;top:0;bottom:0;left:0;right:0;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:#00000050;-webkit-transition:opacity 300ms linear;transition:opacity 300ms linear;opacity:0;}.s9j48u3[data-loading='visible']{opacity:1;}
|
package/dist/utils/intersect.js
CHANGED
|
@@ -128,6 +128,7 @@ exports.applyRotationToVector = applyRotationToVector;
|
|
|
128
128
|
var checkPositionIntersection = function checkPositionIntersection(shape, position, canvasOffset, selectionPadding) {
|
|
129
129
|
var currentScale = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
130
130
|
var checkAnchors = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
131
|
+
if (shape.locked) return false;
|
|
131
132
|
var scaleWithMinCap = Math.min(1, currentScale);
|
|
132
133
|
|
|
133
134
|
var _getShapeInfos = (0, _shapeData.getShapeInfos)(shape, selectionPadding),
|