@yorab/react-paint 0.4.2 → 0.6.1
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 +25 -0
- package/README.md +0 -6
- package/dist/components/App.js +52 -43
- package/dist/components/Canvas.js +6 -6
- package/dist/components/settings/ColorField.js +5 -5
- package/dist/components/settings/FontFamilyField.js +6 -4
- package/dist/components/settings/Layouts.js +17 -8
- package/dist/components/settings/LineArrowField.js +6 -4
- package/dist/components/settings/LineTypeField.js +6 -4
- package/dist/components/settings/PointsNumberField.js +20 -30
- package/dist/components/settings/RangeField.js +1 -0
- package/dist/components/settings/SelectField.js +1 -0
- package/dist/components/settings/SettingsBar.js +141 -88
- package/dist/components/settings/ToggleField.js +56 -0
- package/dist/components/toolbox/EditTextBox.js +17 -10
- package/dist/components/toolbox/LoadFileTool.js +5 -3
- package/dist/components/toolbox/MenuGroup.js +37 -44
- package/dist/components/toolbox/Tool.js +4 -4
- package/dist/components/toolbox/Toolbar.js +81 -69
- package/dist/components/toolbox/ToolbarGroup.js +29 -31
- package/dist/constants/icons.js +6 -2
- package/dist/constants/style.js +3 -1
- package/dist/constants/tools.js +428 -0
- package/dist/hooks/useDoubleClick.js +46 -0
- package/dist/hooks/useDrawableCanvas.js +42 -53
- package/dist/styles.css +10 -10
- package/dist/types/Shapes.js +2 -16
- package/dist/types/tools.js +22 -0
- package/dist/utils/data.js +106 -28
- package/dist/utils/draw.js +3 -3
- package/dist/utils/file.js +15 -14
- package/dist/utils/selection.js +1 -1
- package/dist/utils/style.js +4 -2
- package/dist/utils/toolbar.js +66 -11
- package/dist/utils/transform.js +24 -11
- package/package.json +1 -1
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);}
|
|
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;}
|
|
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%;}
|
|
@@ -43,14 +43,15 @@
|
|
|
43
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;}
|
|
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
|
-
.szboplp{
|
|
47
|
-
.sff5xt[data-
|
|
48
|
-
.sj3bift[data-
|
|
49
|
-
.s10ip0a4[data-
|
|
50
|
-
.s1j9uq9o{
|
|
51
|
-
.s156ddbb{
|
|
52
|
-
.s11gt4hl{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;
|
|
53
|
-
.s13cxqhq{
|
|
46
|
+
.szboplp{margin:2px 0;}.szboplp:not(:hover){opacity:0.2;}
|
|
47
|
+
.sff5xt{border:3px solid transparent;padding:4px 0px;position:relative;background:var(--toolbar-bg);box-sizing:border-box;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:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}.sff5xt[data-is-over='1']{border:3px dotted var(--font-hover-bg);}.sff5xt[data-is-dragging='1']{opacity:0.4;}.sff5xt[data-selected='1']{color:var(--font-selected-color);background:var(--font-selected-bg);}.sff5xt[data-selected='1'] .szboplp{color:white;}.sff5xt[data-selected='0'][data-disabled='0']{background:var(--font-bg);color:var(--font-color);}.sff5xt[data-selected='0'][data-disabled='0']:hover{color:var(--font-hover-color);background:var(--font-hover-bg);}.sff5xt[data-disabled='1']{cursor:default;color:var(--font-disabled-color);background:var(--font-disabled-bg);}.sff5xt[data-disabled='0']{cursor:move;}.sff5xt > span{height:20px;line-height:1;color:#8a8a8a;}.sff5xt > span > svg{fill:#8a8a8a;width:20px;height:20px;padding:0 4px;-webkit-transform:scale(0.75);-ms-transform:scale(0.75);transform:scale(0.75);}
|
|
48
|
+
.sj3bift{margin:2px 0;}.sj3bift[data-visible='false']{opacity:0.2;}
|
|
49
|
+
.s10ip0a4{margin:2px 0;}.s10ip0a4[data-locked='false']{opacity:0.2;}
|
|
50
|
+
.s1j9uq9o[data-grid='false'] svg{opacity:0.2;}
|
|
51
|
+
.s156ddbb{-webkit-flex:1;-ms-flex:1;flex:1;}
|
|
52
|
+
.s11gt4hl{bottom:0;left:unset;top:unset;max-height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
|
|
53
|
+
.s13cxqhq{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;overflow-y:auto;}
|
|
54
|
+
.s1idv8qv{opacity:0.6;text-align:center;padding:12px 0px;}
|
|
54
55
|
.s1bvz4xj{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;bottom:unset;top:100%;}.s1bvz4xj[data-vertical='1']{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
|
|
55
56
|
.siejlch{position:relative;display:inline-block;}
|
|
56
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;}
|
|
@@ -68,7 +69,6 @@
|
|
|
68
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;}
|
|
69
70
|
.s1ktxhkr{padding:16px;}
|
|
70
71
|
.smpmxx5{font-family:var(--smpmxx5-0);}
|
|
71
|
-
|
|
72
72
|
.s1qssg4n{display:inline-block;width:6px;height:2px;background:transparent;vertical-align:middle;}
|
|
73
73
|
.se26iq6{display:inline-block;}.se26iq6[data-type='0'] .s1qssg4n{background:currentColor;}.se26iq6[data-type='1']{position:relative;left:3px;}.se26iq6[data-type='1'] .s1qssg4n:nth-child(3n-1){background:currentColor;width:12px;}.se26iq6[data-type='1'] .s1qssg4n:nth-child(n+11){display:none;}.se26iq6[data-type='2'] .s1qssg4n:nth-child(2n+1){background:currentColor;}
|
|
74
74
|
.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;}
|
package/dist/types/Shapes.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.ShapeEnum = void 0;
|
|
7
7
|
var ShapeEnum;
|
|
8
8
|
exports.ShapeEnum = ShapeEnum;
|
|
9
9
|
|
|
@@ -18,18 +18,4 @@ exports.ShapeEnum = ShapeEnum;
|
|
|
18
18
|
ShapeEnum["ellipse"] = "ellipse";
|
|
19
19
|
ShapeEnum["picture"] = "picture";
|
|
20
20
|
ShapeEnum["text"] = "text";
|
|
21
|
-
})(ShapeEnum || (exports.ShapeEnum = ShapeEnum = {}));
|
|
22
|
-
|
|
23
|
-
var ToolEnum;
|
|
24
|
-
exports.ToolEnum = ToolEnum;
|
|
25
|
-
|
|
26
|
-
(function (ToolEnum) {
|
|
27
|
-
ToolEnum["selection"] = "selection";
|
|
28
|
-
ToolEnum["undo"] = "undo";
|
|
29
|
-
ToolEnum["redo"] = "redo";
|
|
30
|
-
ToolEnum["clear"] = "clear";
|
|
31
|
-
ToolEnum["export"] = "export";
|
|
32
|
-
ToolEnum["loadFile"] = "loadfile";
|
|
33
|
-
ToolEnum["saveFile"] = "savefile";
|
|
34
|
-
ToolEnum["move"] = "move";
|
|
35
|
-
})(ToolEnum || (exports.ToolEnum = ToolEnum = {}));
|
|
21
|
+
})(ShapeEnum || (exports.ShapeEnum = ShapeEnum = {}));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ActionsEnum = void 0;
|
|
7
|
+
// default
|
|
8
|
+
var ActionsEnum;
|
|
9
|
+
exports.ActionsEnum = ActionsEnum;
|
|
10
|
+
|
|
11
|
+
(function (ActionsEnum) {
|
|
12
|
+
ActionsEnum["selection"] = "selection";
|
|
13
|
+
ActionsEnum["undo"] = "undo";
|
|
14
|
+
ActionsEnum["redo"] = "redo";
|
|
15
|
+
ActionsEnum["clear"] = "clear";
|
|
16
|
+
ActionsEnum["export"] = "export";
|
|
17
|
+
ActionsEnum["loadFile"] = "loadfile";
|
|
18
|
+
ActionsEnum["saveFile"] = "savefile";
|
|
19
|
+
ActionsEnum["move"] = "move";
|
|
20
|
+
ActionsEnum["uploadPicture"] = "uploadpicture";
|
|
21
|
+
ActionsEnum["addUrlPicture"] = "addurlpicture";
|
|
22
|
+
})(ActionsEnum || (exports.ActionsEnum = ActionsEnum = {}));
|
package/dist/utils/data.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.roundValues = exports.createShape = exports.createPicture = exports.copyShape = exports.cleanShapesBeforeExport = exports.addDefaultAndTempShapeProps = void 0;
|
|
8
|
+
exports.roundValues = exports.createShape = exports.createPicture = exports.copyShape = exports.cleanShapesBeforeExport = exports.buildDataToExport = exports.addDefaultAndTempShapeProps = void 0;
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
@@ -19,6 +19,8 @@ var _Shapes = require("../types/Shapes");
|
|
|
19
19
|
|
|
20
20
|
var _file = require("./file");
|
|
21
21
|
|
|
22
|
+
var _tools = require("../constants/tools");
|
|
23
|
+
|
|
22
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
25
|
|
|
24
26
|
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; }
|
|
@@ -34,13 +36,14 @@ var createPicture = function createPicture(fileOrUrl, maxPictureWidth, maxPictur
|
|
|
34
36
|
height = _fitContentInsideCont2[1];
|
|
35
37
|
|
|
36
38
|
var pictureShape = {
|
|
39
|
+
toolId: _tools.DEFAULT_SHAPE_PICTURE.id,
|
|
37
40
|
type: _Shapes.ShapeEnum.picture,
|
|
38
41
|
id: _fp["default"].uniqueId("".concat(_Shapes.ShapeEnum.picture, "_")),
|
|
39
42
|
x: (maxPictureWidth - width) / 2,
|
|
40
43
|
y: (maxPictureHeight - height) / 2,
|
|
41
44
|
width: width,
|
|
42
45
|
height: height,
|
|
43
|
-
src: img.src,
|
|
46
|
+
src: fileOrUrl instanceof File ? img.src : fileOrUrl,
|
|
44
47
|
img: img,
|
|
45
48
|
translation: [0, 0],
|
|
46
49
|
rotation: 0
|
|
@@ -48,10 +51,18 @@ var createPicture = function createPicture(fileOrUrl, maxPictureWidth, maxPictur
|
|
|
48
51
|
resolve(pictureShape);
|
|
49
52
|
};
|
|
50
53
|
|
|
54
|
+
img.onerror = function () {
|
|
55
|
+
reject(new Error('Some images could not be loaded'));
|
|
56
|
+
};
|
|
57
|
+
|
|
51
58
|
if (fileOrUrl instanceof File) {
|
|
52
59
|
img.src = URL.createObjectURL(fileOrUrl);
|
|
53
60
|
} else {
|
|
54
|
-
|
|
61
|
+
(0, _file.fetchAndStringify)(fileOrUrl).then(function (picData) {
|
|
62
|
+
img.src = picData;
|
|
63
|
+
})["catch"](function () {
|
|
64
|
+
img.src = ''; // to trigger onerror
|
|
65
|
+
});
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
img.onerror = function () {
|
|
@@ -66,74 +77,112 @@ var createPicture = function createPicture(fileOrUrl, maxPictureWidth, maxPictur
|
|
|
66
77
|
|
|
67
78
|
exports.createPicture = createPicture;
|
|
68
79
|
|
|
69
|
-
var createShape = function createShape(ctx, shape, cursorPosition
|
|
70
|
-
var
|
|
80
|
+
var createShape = function createShape(ctx, shape, cursorPosition) {
|
|
81
|
+
var _shape$settings$fontB, _shape$settings, _shape$settings$fontI, _shape$settings2;
|
|
71
82
|
|
|
72
|
-
switch (shape) {
|
|
83
|
+
switch (shape.type) {
|
|
73
84
|
case _Shapes.ShapeEnum.brush:
|
|
85
|
+
shape.settings;
|
|
74
86
|
return {
|
|
87
|
+
toolId: shape.id,
|
|
75
88
|
type: _Shapes.ShapeEnum.brush,
|
|
76
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
89
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
77
90
|
points: [[cursorPosition]],
|
|
78
91
|
translation: [0, 0],
|
|
79
92
|
rotation: 0,
|
|
80
|
-
style:
|
|
93
|
+
style: {
|
|
94
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
95
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
96
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
97
|
+
lineDash: shape.settings.lineDash["default"]
|
|
98
|
+
}
|
|
81
99
|
};
|
|
82
100
|
|
|
83
101
|
case _Shapes.ShapeEnum.line:
|
|
84
102
|
return {
|
|
103
|
+
toolId: shape.id,
|
|
85
104
|
type: _Shapes.ShapeEnum.line,
|
|
86
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
105
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
87
106
|
points: [cursorPosition, cursorPosition],
|
|
88
107
|
translation: [0, 0],
|
|
89
108
|
rotation: 0,
|
|
90
|
-
style:
|
|
109
|
+
style: {
|
|
110
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
111
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
112
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
113
|
+
lineDash: shape.settings.lineDash["default"],
|
|
114
|
+
lineArrow: shape.settings.lineArrow["default"]
|
|
115
|
+
}
|
|
91
116
|
};
|
|
92
117
|
|
|
93
118
|
case _Shapes.ShapeEnum.polygon:
|
|
94
119
|
return {
|
|
120
|
+
toolId: shape.id,
|
|
95
121
|
type: _Shapes.ShapeEnum.polygon,
|
|
96
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
122
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
97
123
|
points: _fp["default"].flow(_fp["default"].range(0), _fp["default"].map(function () {
|
|
98
124
|
return cursorPosition;
|
|
99
|
-
}))(
|
|
125
|
+
}))(shape.settings.pointsCount["default"]),
|
|
100
126
|
translation: [0, 0],
|
|
101
127
|
rotation: 0,
|
|
102
|
-
style:
|
|
128
|
+
style: {
|
|
129
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
130
|
+
fillColor: shape.settings.fillColor["default"],
|
|
131
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
132
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
133
|
+
lineDash: shape.settings.lineDash["default"],
|
|
134
|
+
pointsCount: shape.settings.pointsCount["default"]
|
|
135
|
+
}
|
|
103
136
|
};
|
|
104
137
|
|
|
105
138
|
case _Shapes.ShapeEnum.curve:
|
|
106
139
|
return {
|
|
140
|
+
toolId: shape.id,
|
|
107
141
|
type: _Shapes.ShapeEnum.curve,
|
|
108
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
142
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
109
143
|
points: _fp["default"].flow(_fp["default"].range(0), _fp["default"].map(function () {
|
|
110
144
|
return cursorPosition;
|
|
111
|
-
}))(
|
|
145
|
+
}))(shape.settings.pointsCount["default"]),
|
|
112
146
|
translation: [0, 0],
|
|
113
147
|
rotation: 0,
|
|
114
|
-
style:
|
|
148
|
+
style: {
|
|
149
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
150
|
+
fillColor: shape.settings.fillColor["default"],
|
|
151
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
152
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
153
|
+
lineDash: shape.settings.lineDash["default"],
|
|
154
|
+
pointsCount: shape.settings.pointsCount["default"]
|
|
155
|
+
}
|
|
115
156
|
};
|
|
116
157
|
|
|
117
158
|
case _Shapes.ShapeEnum.rect:
|
|
118
159
|
case _Shapes.ShapeEnum.square:
|
|
119
160
|
return {
|
|
120
|
-
|
|
121
|
-
|
|
161
|
+
toolId: shape.id,
|
|
162
|
+
type: shape.type,
|
|
163
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
122
164
|
x: cursorPosition[0],
|
|
123
165
|
y: cursorPosition[1],
|
|
124
166
|
width: 1,
|
|
125
167
|
height: 1,
|
|
126
168
|
translation: [0, 0],
|
|
127
169
|
rotation: 0,
|
|
128
|
-
style:
|
|
170
|
+
style: {
|
|
171
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
172
|
+
fillColor: shape.settings.fillColor["default"],
|
|
173
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
174
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
175
|
+
lineDash: shape.settings.lineDash["default"]
|
|
176
|
+
}
|
|
129
177
|
};
|
|
130
178
|
|
|
131
179
|
case _Shapes.ShapeEnum.text:
|
|
132
|
-
var defaultValue = [];
|
|
133
|
-
var fontSize = (0, _transform.calculateTextFontSize)(ctx, defaultValue, 50, (
|
|
180
|
+
var defaultValue = ['Texte'];
|
|
181
|
+
var fontSize = (0, _transform.calculateTextFontSize)(ctx, defaultValue, 50, (_shape$settings$fontB = (_shape$settings = shape.settings) === null || _shape$settings === void 0 ? void 0 : _shape$settings.fontBold["default"]) !== null && _shape$settings$fontB !== void 0 ? _shape$settings$fontB : false, (_shape$settings$fontI = (_shape$settings2 = shape.settings) === null || _shape$settings2 === void 0 ? void 0 : _shape$settings2.fontItalic["default"]) !== null && _shape$settings$fontI !== void 0 ? _shape$settings$fontI : false, shape.settings.fontFamily["default"]);
|
|
134
182
|
return {
|
|
183
|
+
toolId: shape.id,
|
|
135
184
|
type: _Shapes.ShapeEnum.text,
|
|
136
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
185
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
137
186
|
x: cursorPosition[0],
|
|
138
187
|
y: cursorPosition[1],
|
|
139
188
|
value: defaultValue,
|
|
@@ -142,33 +191,50 @@ var createShape = function createShape(ctx, shape, cursorPosition, defaultConf)
|
|
|
142
191
|
height: fontSize * (defaultValue.length || 1),
|
|
143
192
|
translation: [0, 0],
|
|
144
193
|
rotation: 0,
|
|
145
|
-
style:
|
|
194
|
+
style: {
|
|
195
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
196
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
197
|
+
fontFamily: shape.settings.fontFamily["default"]
|
|
198
|
+
}
|
|
146
199
|
};
|
|
147
200
|
|
|
148
201
|
case _Shapes.ShapeEnum.ellipse:
|
|
149
202
|
return {
|
|
203
|
+
toolId: shape.id,
|
|
150
204
|
type: _Shapes.ShapeEnum.ellipse,
|
|
151
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
205
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
152
206
|
x: cursorPosition[0],
|
|
153
207
|
y: cursorPosition[1],
|
|
154
208
|
radiusX: 0,
|
|
155
209
|
radiusY: 0,
|
|
156
210
|
translation: [0, 0],
|
|
157
211
|
rotation: 0,
|
|
158
|
-
style:
|
|
212
|
+
style: {
|
|
213
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
214
|
+
fillColor: shape.settings.fillColor["default"],
|
|
215
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
216
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
217
|
+
lineDash: shape.settings.lineDash["default"]
|
|
218
|
+
}
|
|
159
219
|
};
|
|
160
220
|
|
|
161
221
|
case _Shapes.ShapeEnum.circle:
|
|
162
|
-
default:
|
|
163
222
|
return {
|
|
223
|
+
toolId: shape.id,
|
|
164
224
|
type: _Shapes.ShapeEnum.circle,
|
|
165
|
-
id: _fp["default"].uniqueId("".concat(shape, "_")),
|
|
225
|
+
id: _fp["default"].uniqueId("".concat(shape.type, "_")),
|
|
166
226
|
x: cursorPosition[0],
|
|
167
227
|
y: cursorPosition[1],
|
|
168
228
|
radius: 0,
|
|
169
229
|
translation: [0, 0],
|
|
170
230
|
rotation: 0,
|
|
171
|
-
style:
|
|
231
|
+
style: {
|
|
232
|
+
globalAlpha: shape.settings.opacity["default"],
|
|
233
|
+
fillColor: shape.settings.fillColor["default"],
|
|
234
|
+
strokeColor: shape.settings.strokeColor["default"],
|
|
235
|
+
lineWidth: shape.settings.lineWidth["default"],
|
|
236
|
+
lineDash: shape.settings.lineDash["default"]
|
|
237
|
+
}
|
|
172
238
|
};
|
|
173
239
|
}
|
|
174
240
|
};
|
|
@@ -221,6 +287,18 @@ var cleanShapesBeforeExport = function cleanShapesBeforeExport(shapes) {
|
|
|
221
287
|
|
|
222
288
|
exports.cleanShapesBeforeExport = cleanShapesBeforeExport;
|
|
223
289
|
|
|
290
|
+
var buildDataToExport = function buildDataToExport(shapes, width, height) {
|
|
291
|
+
return {
|
|
292
|
+
shapes: cleanShapesBeforeExport(shapes),
|
|
293
|
+
config: {
|
|
294
|
+
width: width,
|
|
295
|
+
height: height
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
exports.buildDataToExport = buildDataToExport;
|
|
301
|
+
|
|
224
302
|
var addDefaultAndTempShapeProps = function addDefaultAndTempShapeProps(shape) {
|
|
225
303
|
return _objectSpread(_objectSpread({}, shape), {}, {
|
|
226
304
|
id: _fp["default"].uniqueId("".concat(shape.type, "_"))
|
package/dist/utils/draw.js
CHANGED
|
@@ -225,12 +225,12 @@ var drawRect = function drawRect(ctx, rect) {
|
|
|
225
225
|
exports.drawRect = drawRect;
|
|
226
226
|
|
|
227
227
|
var drawText = function drawText(ctx, text) {
|
|
228
|
-
var _text$style, _text$style$fontFamil, _text$
|
|
228
|
+
var _text$style, _text$style2, _text$style3, _text$style$fontFamil, _text$style4;
|
|
229
229
|
|
|
230
230
|
updateDrawStyle(ctx, text.style);
|
|
231
231
|
if (ctx.globalAlpha === 0 || !((_text$style = text.style) !== null && _text$style !== void 0 && _text$style.strokeColor) || text.style.strokeColor === 'transparent') return;
|
|
232
|
-
ctx.font = "".concat(text.fontSize, "px ").concat((_text$style$fontFamil = (_text$
|
|
233
|
-
ctx.textBaseline = '
|
|
232
|
+
ctx.font = "".concat((_text$style2 = text.style) !== null && _text$style2 !== void 0 && _text$style2.fontItalic ? 'italic' : '', " ").concat((_text$style3 = text.style) !== null && _text$style3 !== void 0 && _text$style3.fontBold ? 'bold' : '', " ").concat(text.fontSize, "px ").concat((_text$style$fontFamil = (_text$style4 = text.style) === null || _text$style4 === void 0 ? void 0 : _text$style4.fontFamily) !== null && _text$style$fontFamil !== void 0 ? _text$style$fontFamil : _style.STYLE_FONT_DEFAULT);
|
|
233
|
+
ctx.textBaseline = 'top';
|
|
234
234
|
ctx.fillStyle = text.style.strokeColor;
|
|
235
235
|
|
|
236
236
|
for (var i = 0; i < text.value.length; i++) {
|
package/dist/utils/file.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getCanvasImage = exports.getBase64Image = exports.fetchAndStringify = exports.encodeShapesInString = exports.downloadFile = exports.
|
|
8
|
+
exports.getCanvasImage = exports.getBase64Image = exports.fetchAndStringify = exports.encodeShapesInString = exports.downloadFile = exports.decodeJson = exports.decodeImportedData = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
@@ -80,9 +80,9 @@ var getCanvasImage = function getCanvasImage(shapes, canvasOffset, width, height
|
|
|
80
80
|
|
|
81
81
|
exports.getCanvasImage = getCanvasImage;
|
|
82
82
|
|
|
83
|
-
var encodeShapesInString = function encodeShapesInString(shapes) {
|
|
84
|
-
var
|
|
85
|
-
return encodeObjectToString(
|
|
83
|
+
var encodeShapesInString = function encodeShapesInString(shapes, width, height) {
|
|
84
|
+
var dataToExport = (0, _data.buildDataToExport)(shapes, width, height);
|
|
85
|
+
return encodeObjectToString(dataToExport);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
exports.encodeShapesInString = encodeShapesInString;
|
|
@@ -123,14 +123,15 @@ var decodeJson = /*#__PURE__*/function () {
|
|
|
123
123
|
|
|
124
124
|
exports.decodeJson = decodeJson;
|
|
125
125
|
|
|
126
|
-
var
|
|
126
|
+
var decodeImportedData = /*#__PURE__*/function () {
|
|
127
127
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(shapesForJson) {
|
|
128
|
-
var promisesArray, shapes;
|
|
128
|
+
var promisesArray, jsonShapes, shapes;
|
|
129
129
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
130
130
|
while (1) {
|
|
131
131
|
switch (_context2.prev = _context2.next) {
|
|
132
132
|
case 0:
|
|
133
133
|
promisesArray = [];
|
|
134
|
+
jsonShapes = shapesForJson.shapes;
|
|
134
135
|
shapes = _fp["default"].flow(_fp["default"].map(function (shape) {
|
|
135
136
|
if (!_fp["default"].includes(shape.type, _Shapes.ShapeEnum)) return null;
|
|
136
137
|
|
|
@@ -157,20 +158,20 @@ var decodePicturesInShapes = /*#__PURE__*/function () {
|
|
|
157
158
|
img.src = shape.src;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
return _objectSpread(_objectSpread({}, shape), {}, {
|
|
161
|
+
return (0, _data.addDefaultAndTempShapeProps)(_objectSpread(_objectSpread({}, shape), {}, {
|
|
161
162
|
img: img
|
|
162
|
-
});
|
|
163
|
+
}));
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
return (0, _data.addDefaultAndTempShapeProps)(shape);
|
|
166
|
-
}), _fp["default"].compact)(
|
|
167
|
-
_context2.next =
|
|
167
|
+
}), _fp["default"].compact)(jsonShapes);
|
|
168
|
+
_context2.next = 5;
|
|
168
169
|
return Promise.all(promisesArray);
|
|
169
170
|
|
|
170
|
-
case
|
|
171
|
+
case 5:
|
|
171
172
|
return _context2.abrupt("return", shapes);
|
|
172
173
|
|
|
173
|
-
case
|
|
174
|
+
case 6:
|
|
174
175
|
case "end":
|
|
175
176
|
return _context2.stop();
|
|
176
177
|
}
|
|
@@ -178,9 +179,9 @@ var decodePicturesInShapes = /*#__PURE__*/function () {
|
|
|
178
179
|
}, _callee2);
|
|
179
180
|
}));
|
|
180
181
|
|
|
181
|
-
return function
|
|
182
|
+
return function decodeImportedData(_x2) {
|
|
182
183
|
return _ref2.apply(this, arguments);
|
|
183
184
|
};
|
|
184
185
|
}();
|
|
185
186
|
|
|
186
|
-
exports.
|
|
187
|
+
exports.decodeImportedData = decodeImportedData;
|
package/dist/utils/selection.js
CHANGED
|
@@ -54,7 +54,7 @@ var selectShape = function selectShape(shapes, cursorPosition, currentScale, can
|
|
|
54
54
|
};
|
|
55
55
|
var newSelectionMode = getNewSelectionData(positionIntersection, selectedShape, cursorPosition, selectionPadding);
|
|
56
56
|
|
|
57
|
-
if (newSelectionMode) {
|
|
57
|
+
if ((newSelectionMode === null || newSelectionMode === void 0 ? void 0 : newSelectionMode.mode) === _Mode.SelectionModeLib.resize || (newSelectionMode === null || newSelectionMode === void 0 ? void 0 : newSelectionMode.mode) === _Mode.SelectionModeLib.rotate) {
|
|
58
58
|
return {
|
|
59
59
|
shape: selectedShape,
|
|
60
60
|
mode: newSelectionMode
|
package/dist/utils/style.js
CHANGED
|
@@ -24,7 +24,8 @@ var getShapePicture = function getShapePicture(shape) {
|
|
|
24
24
|
return _icons.curveIcon;
|
|
25
25
|
|
|
26
26
|
case _Shapes.ShapeEnum.rect:
|
|
27
|
-
return _icons.
|
|
27
|
+
return _icons.squareIcon;
|
|
28
|
+
// temporary
|
|
28
29
|
|
|
29
30
|
case _Shapes.ShapeEnum.square:
|
|
30
31
|
return _icons.squareIcon;
|
|
@@ -33,7 +34,8 @@ var getShapePicture = function getShapePicture(shape) {
|
|
|
33
34
|
return _icons.circleIcon;
|
|
34
35
|
|
|
35
36
|
case _Shapes.ShapeEnum.ellipse:
|
|
36
|
-
return _icons.
|
|
37
|
+
return _icons.circleIcon;
|
|
38
|
+
// temporary
|
|
37
39
|
|
|
38
40
|
case _Shapes.ShapeEnum.text:
|
|
39
41
|
return _icons.textIcon;
|
package/dist/utils/toolbar.js
CHANGED
|
@@ -5,33 +5,88 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getCurrentStructure = void 0;
|
|
8
|
+
exports.sanitizeTools = exports.getCurrentStructure = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
11
|
|
|
10
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
13
|
|
|
14
|
+
var _Shapes = require("../types/Shapes");
|
|
15
|
+
|
|
12
16
|
var _fp = _interopRequireDefault(require("lodash/fp"));
|
|
13
17
|
|
|
18
|
+
var _tools = require("../constants/tools");
|
|
19
|
+
|
|
14
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
21
|
|
|
16
22
|
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; }
|
|
17
23
|
|
|
18
24
|
var getCurrentStructure = function getCurrentStructure(availableTools, defaultStructure) {
|
|
19
|
-
return _fp["default"].flow(_fp["default"].
|
|
25
|
+
return _fp["default"].flow(_fp["default"].flatMap(function (group) {
|
|
20
26
|
if (!_fp["default"].isObject(group)) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return null;
|
|
27
|
+
return _fp["default"].filter({
|
|
28
|
+
type: group
|
|
29
|
+
}, availableTools);
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
var
|
|
32
|
+
var toolsType = _fp["default"].filter(function (tool) {
|
|
33
|
+
return _fp["default"].includes(tool.type, group.toolsType);
|
|
34
|
+
}, availableTools);
|
|
29
35
|
|
|
30
|
-
if (!
|
|
36
|
+
if (!toolsType) return null;
|
|
31
37
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
32
|
-
|
|
38
|
+
toolsType: toolsType
|
|
33
39
|
});
|
|
34
40
|
}), _fp["default"].compact)(defaultStructure);
|
|
35
41
|
};
|
|
36
42
|
|
|
37
|
-
exports.getCurrentStructure = getCurrentStructure;
|
|
43
|
+
exports.getCurrentStructure = getCurrentStructure;
|
|
44
|
+
|
|
45
|
+
var sanitizeTools = function sanitizeTools(tools) {
|
|
46
|
+
var withPicture = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
47
|
+
|
|
48
|
+
var customizer = function customizer(objValue, srcValue) {
|
|
49
|
+
if (_fp["default"].isArray(objValue)) {
|
|
50
|
+
return srcValue;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return _fp["default"].flow(_fp["default"].map(function (tool) {
|
|
55
|
+
if (!_fp["default"].isObject(tool)) return null;
|
|
56
|
+
|
|
57
|
+
switch (_fp["default"].get('type', tool)) {
|
|
58
|
+
case _Shapes.ShapeEnum.brush:
|
|
59
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_BRUSH, tool);
|
|
60
|
+
|
|
61
|
+
case _Shapes.ShapeEnum.circle:
|
|
62
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_CIRCLE, tool);
|
|
63
|
+
|
|
64
|
+
case _Shapes.ShapeEnum.curve:
|
|
65
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_CURVE, tool);
|
|
66
|
+
|
|
67
|
+
case _Shapes.ShapeEnum.ellipse:
|
|
68
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_ELLIPSE, tool);
|
|
69
|
+
|
|
70
|
+
case _Shapes.ShapeEnum.line:
|
|
71
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_LINE, tool);
|
|
72
|
+
|
|
73
|
+
case _Shapes.ShapeEnum.polygon:
|
|
74
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_POLYGON, tool);
|
|
75
|
+
|
|
76
|
+
case _Shapes.ShapeEnum.rect:
|
|
77
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_RECT, tool);
|
|
78
|
+
|
|
79
|
+
case _Shapes.ShapeEnum.square:
|
|
80
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_SQUARE, tool);
|
|
81
|
+
|
|
82
|
+
case _Shapes.ShapeEnum.text:
|
|
83
|
+
return _fp["default"].mergeWith(customizer, _tools.DEFAULT_SHAPE_TEXT, tool);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return null;
|
|
87
|
+
}), function (tools) {
|
|
88
|
+
return withPicture ? [].concat((0, _toConsumableArray2["default"])(tools), [_tools.DEFAULT_SHAPE_PICTURE]) : tools;
|
|
89
|
+
}, _fp["default"].compact)(tools);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.sanitizeTools = sanitizeTools;
|