react-design-editor 0.0.50 → 0.0.52

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.
Files changed (100) hide show
  1. package/dist/react-design-editor.js +7739 -7114
  2. package/dist/react-design-editor.min.js +1 -1
  3. package/dist/react-design-editor.min.js.LICENSE.txt +2 -0
  4. package/lib/Canvas.d.ts +18 -18
  5. package/lib/Canvas.js +172 -172
  6. package/lib/CanvasObject.d.ts +10 -10
  7. package/lib/CanvasObject.js +96 -96
  8. package/lib/constants/code.d.ts +19 -19
  9. package/lib/constants/code.js +22 -22
  10. package/lib/constants/defaults.d.ts +38 -38
  11. package/lib/constants/defaults.js +69 -69
  12. package/lib/constants/index.d.ts +3 -3
  13. package/lib/constants/index.js +26 -26
  14. package/lib/handlers/AlignmentHandler.d.ts +18 -18
  15. package/lib/handlers/AlignmentHandler.js +58 -58
  16. package/lib/handlers/AnimationHandler.d.ts +50 -50
  17. package/lib/handlers/AnimationHandler.js +346 -346
  18. package/lib/handlers/ChartHandler.d.ts +8 -8
  19. package/lib/handlers/ChartHandler.js +8 -8
  20. package/lib/handlers/ContextmenuHandler.d.ts +28 -28
  21. package/lib/handlers/ContextmenuHandler.js +65 -65
  22. package/lib/handlers/CropHandler.d.ts +43 -43
  23. package/lib/handlers/CropHandler.js +261 -261
  24. package/lib/handlers/CustomHandler.d.ts +7 -7
  25. package/lib/handlers/CustomHandler.js +10 -10
  26. package/lib/handlers/DrawingHandler.d.ts +28 -28
  27. package/lib/handlers/DrawingHandler.js +318 -318
  28. package/lib/handlers/ElementHandler.d.ts +80 -80
  29. package/lib/handlers/ElementHandler.js +154 -154
  30. package/lib/handlers/EventHandler.d.ts +170 -170
  31. package/lib/handlers/EventHandler.js +880 -880
  32. package/lib/handlers/FiberHandler.d.ts +6 -6
  33. package/lib/handlers/FiberHandler.js +23 -23
  34. package/lib/handlers/GridHandler.d.ts +19 -19
  35. package/lib/handlers/GridHandler.js +77 -77
  36. package/lib/handlers/GuidelineHandler.d.ts +61 -61
  37. package/lib/handlers/GuidelineHandler.js +315 -315
  38. package/lib/handlers/Handler.d.ts +618 -618
  39. package/lib/handlers/Handler.js +1645 -1645
  40. package/lib/handlers/ImageHandler.d.ts +307 -307
  41. package/lib/handlers/ImageHandler.js +528 -528
  42. package/lib/handlers/InteractionHandler.d.ts +45 -45
  43. package/lib/handlers/InteractionHandler.js +168 -164
  44. package/lib/handlers/LinkHandler.d.ts +115 -115
  45. package/lib/handlers/LinkHandler.js +247 -247
  46. package/lib/handlers/NodeHandler.d.ts +50 -50
  47. package/lib/handlers/NodeHandler.js +274 -274
  48. package/lib/handlers/PortHandler.d.ts +22 -22
  49. package/lib/handlers/PortHandler.js +179 -179
  50. package/lib/handlers/ShortcutHandler.d.ts +119 -119
  51. package/lib/handlers/ShortcutHandler.js +151 -151
  52. package/lib/handlers/TooltipHandler.d.ts +33 -33
  53. package/lib/handlers/TooltipHandler.js +91 -91
  54. package/lib/handlers/TransactionHandler.d.ts +59 -59
  55. package/lib/handlers/TransactionHandler.js +137 -137
  56. package/lib/handlers/WorkareaHandler.d.ts +43 -43
  57. package/lib/handlers/WorkareaHandler.js +354 -354
  58. package/lib/handlers/ZoomHandler.d.ts +48 -48
  59. package/lib/handlers/ZoomHandler.js +143 -143
  60. package/lib/handlers/index.d.ts +23 -23
  61. package/lib/handlers/index.js +48 -48
  62. package/lib/index.d.ts +6 -6
  63. package/lib/index.js +20 -20
  64. package/lib/objects/Arrow.d.ts +2 -2
  65. package/lib/objects/Arrow.js +40 -40
  66. package/lib/objects/Chart.d.ts +10 -10
  67. package/lib/objects/Chart.js +117 -117
  68. package/lib/objects/CirclePort.d.ts +2 -2
  69. package/lib/objects/CirclePort.js +28 -28
  70. package/lib/objects/Cube.d.ts +5 -5
  71. package/lib/objects/Cube.js +71 -71
  72. package/lib/objects/CurvedLink.d.ts +2 -2
  73. package/lib/objects/CurvedLink.js +51 -51
  74. package/lib/objects/Element.d.ts +13 -13
  75. package/lib/objects/Element.js +77 -77
  76. package/lib/objects/Gif.d.ts +3 -3
  77. package/lib/objects/Gif.js +41 -41
  78. package/lib/objects/Iframe.d.ts +9 -9
  79. package/lib/objects/Iframe.js +63 -63
  80. package/lib/objects/Line.d.ts +2 -2
  81. package/lib/objects/Line.js +24 -24
  82. package/lib/objects/Link.d.ts +15 -15
  83. package/lib/objects/Link.js +107 -107
  84. package/lib/objects/Node.d.ts +59 -59
  85. package/lib/objects/Node.js +271 -271
  86. package/lib/objects/OrthogonalLink.d.ts +2 -2
  87. package/lib/objects/OrthogonalLink.js +54 -54
  88. package/lib/objects/Port.d.ts +12 -12
  89. package/lib/objects/Port.js +28 -28
  90. package/lib/objects/Svg.d.ts +12 -12
  91. package/lib/objects/Svg.js +93 -93
  92. package/lib/objects/Video.d.ts +14 -14
  93. package/lib/objects/Video.js +113 -113
  94. package/lib/objects/index.d.ts +15 -15
  95. package/lib/objects/index.js +32 -32
  96. package/lib/utils/ObjectUtil.d.ts +408 -408
  97. package/lib/utils/ObjectUtil.js +13 -13
  98. package/lib/utils/index.d.ts +1 -1
  99. package/lib/utils/index.js +13 -13
  100. package/package.json +1 -1
@@ -1,346 +1,346 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const animejs_1 = __importDefault(require("animejs"));
7
- const warning_1 = __importDefault(require("warning"));
8
- class AnimationHandler {
9
- constructor(handler) {
10
- /**
11
- * Play the animation
12
- * @param {string} id
13
- * @param {boolean} [hasControls]
14
- * @returns
15
- */
16
- this.play = (id, hasControls) => {
17
- const findObject = this.handler.findById(id);
18
- if (!findObject) {
19
- return;
20
- }
21
- if (findObject.anime) {
22
- findObject.anime.restart();
23
- return;
24
- }
25
- if (findObject.animation.type === 'none') {
26
- return;
27
- }
28
- const instance = this.getAnime(findObject, hasControls);
29
- if (instance) {
30
- findObject.set('anime', instance);
31
- findObject.set({
32
- hasControls: false,
33
- lockMovementX: true,
34
- lockMovementY: true,
35
- hoverCursor: 'pointer',
36
- });
37
- this.handler.canvas.requestRenderAll();
38
- instance.play();
39
- }
40
- };
41
- /**
42
- * Pause the animation
43
- * @param {string} id
44
- * @returns
45
- */
46
- this.pause = (id) => {
47
- const findObject = this.handler.findById(id);
48
- if (!findObject) {
49
- return;
50
- }
51
- findObject.anime.pause();
52
- };
53
- /**
54
- * Stop the animation
55
- * @param {string} id
56
- * @param {boolean} [hasControls=true]
57
- * @returns
58
- */
59
- this.stop = (id, hasControls = true) => {
60
- const findObject = this.handler.findById(id);
61
- if (!findObject) {
62
- return;
63
- }
64
- this.resetAnimation(findObject, hasControls);
65
- };
66
- /**
67
- * Restart the animation
68
- * @param {string} id
69
- * @returns
70
- */
71
- this.restart = (id) => {
72
- const findObject = this.handler.findById(id);
73
- if (!findObject) {
74
- return;
75
- }
76
- if (!findObject.anime) {
77
- return;
78
- }
79
- this.stop(id);
80
- this.play(id);
81
- };
82
- /**
83
- * Reset animation
84
- *
85
- * @param {FabricObject} obj
86
- * @param {boolean} [hasControls=true]
87
- * @returns
88
- */
89
- this.resetAnimation = (obj, hasControls = true) => {
90
- if (!obj.anime) {
91
- return;
92
- }
93
- let option;
94
- if (this.handler.editable) {
95
- option = {
96
- anime: null,
97
- hasControls,
98
- lockMovementX: !hasControls,
99
- lockMovementY: !hasControls,
100
- hoverCursor: hasControls ? 'move' : 'pointer',
101
- };
102
- }
103
- else {
104
- option = {
105
- anime: null,
106
- hasControls: false,
107
- lockMovementX: true,
108
- lockMovementY: true,
109
- hoverCursor: 'pointer',
110
- };
111
- }
112
- animejs_1.default.remove(obj);
113
- const { type } = obj.animation;
114
- if (type === 'fade') {
115
- Object.assign(option, {
116
- opacity: obj.originOpacity,
117
- originOpacity: null,
118
- });
119
- }
120
- else if (type === 'bounce') {
121
- if (obj.animation.bounce === 'vertical') {
122
- Object.assign(option, {
123
- top: obj.originTop,
124
- originTop: null,
125
- });
126
- }
127
- else {
128
- Object.assign(option, {
129
- left: obj.originLeft,
130
- originLeft: null,
131
- });
132
- }
133
- }
134
- else if (type === 'shake') {
135
- if (obj.animation.shake === 'vertical') {
136
- Object.assign(option, {
137
- top: obj.originTop,
138
- originTop: null,
139
- });
140
- }
141
- else {
142
- Object.assign(option, {
143
- left: obj.originLeft,
144
- originLeft: null,
145
- });
146
- }
147
- }
148
- else if (type === 'scaling') {
149
- Object.assign(option, {
150
- scaleX: obj.originScaleX,
151
- scaleY: obj.originScaleY,
152
- originScaleX: null,
153
- originScaleY: null,
154
- });
155
- }
156
- else if (type === 'rotation') {
157
- Object.assign(option, {
158
- angle: obj.originAngle,
159
- rotation: obj.originAngle,
160
- left: obj.originLeft,
161
- top: obj.originTop,
162
- originLeft: null,
163
- originTop: null,
164
- originAngle: null,
165
- });
166
- }
167
- else if (type === 'flash') {
168
- if (obj.type === 'svg') {
169
- obj._objects.forEach(child => this.handler.setByPartial(child, {
170
- fill: child.originFill,
171
- stroke: child.originStroke,
172
- originFill: null,
173
- originStroke: null,
174
- }));
175
- }
176
- Object.assign(option, {
177
- fill: obj.originFill,
178
- stroke: obj.originStroke,
179
- originFill: null,
180
- originStroke: null,
181
- });
182
- }
183
- else {
184
- console.warn('Not supported type.');
185
- }
186
- obj.set(option);
187
- this.handler.canvas.renderAll();
188
- };
189
- /**
190
- * Get animation option
191
- *
192
- * @param {FabricObject} obj
193
- * @param {boolean} [hasControls]
194
- * @returns
195
- */
196
- this.getAnime = (obj, hasControls) => {
197
- const { delay = 0, duration = 100, autoplay = true, loop = true, type, ...other } = obj.animation;
198
- const option = {
199
- targets: obj,
200
- delay,
201
- loop,
202
- autoplay,
203
- duration,
204
- direction: 'alternate',
205
- begin: () => {
206
- obj.set({
207
- hasControls: false,
208
- lockMovementX: true,
209
- lockMovementY: true,
210
- hoverCursor: 'pointer',
211
- });
212
- this.handler.canvas.requestRenderAll();
213
- },
214
- update: (instance) => {
215
- if (type === 'flash') {
216
- // I don't know why it works. Magic code...
217
- warning_1.default(instance.animations[0], 'instance.animations[0] undefined.');
218
- warning_1.default(instance.animations[1], 'instance.animations[1] undefined.');
219
- const fill = instance.animations[0]?.currentValue;
220
- const stroke = instance.animations[1]?.currentValue;
221
- if (obj.type === 'svg') {
222
- obj.setFill(fill);
223
- obj.setStroke(stroke);
224
- }
225
- else {
226
- obj.set('fill', '');
227
- obj.set('fill', fill);
228
- obj.set('stroke', stroke);
229
- }
230
- }
231
- else if (type === 'rotation') {
232
- let angle = instance.animations[0].currentValue;
233
- if (typeof angle === 'string') {
234
- angle = parseInt(angle, 10);
235
- }
236
- obj.rotate(angle);
237
- this.handler.canvas.requestRenderAll();
238
- return;
239
- }
240
- obj.setCoords();
241
- this.handler.canvas.requestRenderAll();
242
- },
243
- complete: () => {
244
- this.resetAnimation(obj, hasControls);
245
- },
246
- };
247
- if (type === 'fade') {
248
- const { opacity = 0 } = other;
249
- obj.set('originOpacity', obj.opacity);
250
- Object.assign(option, {
251
- opacity,
252
- easing: 'easeInQuad',
253
- });
254
- }
255
- else if (type === 'bounce') {
256
- const { offset = 1 } = other;
257
- if (other.bounce === 'vertical') {
258
- obj.set('originTop', obj.top);
259
- Object.assign(option, {
260
- top: obj.top + offset,
261
- easing: 'easeInQuad',
262
- });
263
- }
264
- else {
265
- obj.set('originLeft', obj.left);
266
- Object.assign(option, {
267
- left: obj.left + offset,
268
- easing: 'easeInQuad',
269
- });
270
- }
271
- }
272
- else if (type === 'shake') {
273
- const { offset = 1 } = other;
274
- if (other.shake === 'vertical') {
275
- obj.set('originTop', obj.top);
276
- Object.assign(option, {
277
- top: obj.top + offset,
278
- delay: 0,
279
- elasticity: 1000,
280
- duration: 500,
281
- });
282
- }
283
- else {
284
- obj.set('originLeft', obj.left);
285
- Object.assign(option, {
286
- left: obj.left + offset,
287
- delay: 0,
288
- elasticity: 1000,
289
- duration: 500,
290
- });
291
- }
292
- }
293
- else if (type === 'scaling') {
294
- const { scale = 2 } = other;
295
- obj.set('originScaleX', obj.scaleX);
296
- obj.set('originScaleY', obj.scaleY);
297
- obj.set({
298
- originScaleX: obj.scaleX,
299
- originScaleY: obj.scaleY,
300
- });
301
- const scaleX = obj.scaleX * scale;
302
- const scaleY = obj.scaleY * scale;
303
- Object.assign(option, {
304
- scaleX,
305
- scaleY,
306
- easing: 'easeInQuad',
307
- });
308
- }
309
- else if (type === 'rotation') {
310
- const { angle = 360 } = other;
311
- obj.set('rotation', obj.angle);
312
- obj.set('originAngle', obj.angle);
313
- obj.set('originLeft', obj.left);
314
- obj.set('originTop', obj.top);
315
- Object.assign(option, {
316
- rotation: angle,
317
- easing: 'linear',
318
- direction: 'normal',
319
- });
320
- }
321
- else if (type === 'flash') {
322
- const { fill = obj.fill, stroke = obj.stroke } = other;
323
- if (obj.type === 'svg') {
324
- obj._objects.forEach(child => this.handler.setByPartial(child, {
325
- originFill: child.fill,
326
- originStroke: child.stroke,
327
- }));
328
- }
329
- obj.set('originFill', obj.fill);
330
- obj.set('originStroke', obj.stroke);
331
- Object.assign(option, {
332
- fill,
333
- stroke,
334
- easing: 'easeInQuad',
335
- });
336
- }
337
- else {
338
- console.warn('Not supported type.');
339
- return null;
340
- }
341
- return animejs_1.default(option);
342
- };
343
- this.handler = handler;
344
- }
345
- }
346
- exports.default = AnimationHandler;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const animejs_1 = __importDefault(require("animejs"));
7
+ const warning_1 = __importDefault(require("warning"));
8
+ class AnimationHandler {
9
+ constructor(handler) {
10
+ /**
11
+ * Play the animation
12
+ * @param {string} id
13
+ * @param {boolean} [hasControls]
14
+ * @returns
15
+ */
16
+ this.play = (id, hasControls) => {
17
+ const findObject = this.handler.findById(id);
18
+ if (!findObject) {
19
+ return;
20
+ }
21
+ if (findObject.anime) {
22
+ findObject.anime.restart();
23
+ return;
24
+ }
25
+ if (findObject.animation.type === 'none') {
26
+ return;
27
+ }
28
+ const instance = this.getAnime(findObject, hasControls);
29
+ if (instance) {
30
+ findObject.set('anime', instance);
31
+ findObject.set({
32
+ hasControls: false,
33
+ lockMovementX: true,
34
+ lockMovementY: true,
35
+ hoverCursor: 'pointer',
36
+ });
37
+ this.handler.canvas.requestRenderAll();
38
+ instance.play();
39
+ }
40
+ };
41
+ /**
42
+ * Pause the animation
43
+ * @param {string} id
44
+ * @returns
45
+ */
46
+ this.pause = (id) => {
47
+ const findObject = this.handler.findById(id);
48
+ if (!findObject) {
49
+ return;
50
+ }
51
+ findObject.anime.pause();
52
+ };
53
+ /**
54
+ * Stop the animation
55
+ * @param {string} id
56
+ * @param {boolean} [hasControls=true]
57
+ * @returns
58
+ */
59
+ this.stop = (id, hasControls = true) => {
60
+ const findObject = this.handler.findById(id);
61
+ if (!findObject) {
62
+ return;
63
+ }
64
+ this.resetAnimation(findObject, hasControls);
65
+ };
66
+ /**
67
+ * Restart the animation
68
+ * @param {string} id
69
+ * @returns
70
+ */
71
+ this.restart = (id) => {
72
+ const findObject = this.handler.findById(id);
73
+ if (!findObject) {
74
+ return;
75
+ }
76
+ if (!findObject.anime) {
77
+ return;
78
+ }
79
+ this.stop(id);
80
+ this.play(id);
81
+ };
82
+ /**
83
+ * Reset animation
84
+ *
85
+ * @param {FabricObject} obj
86
+ * @param {boolean} [hasControls=true]
87
+ * @returns
88
+ */
89
+ this.resetAnimation = (obj, hasControls = true) => {
90
+ if (!obj.anime) {
91
+ return;
92
+ }
93
+ let option;
94
+ if (this.handler.editable) {
95
+ option = {
96
+ anime: null,
97
+ hasControls,
98
+ lockMovementX: !hasControls,
99
+ lockMovementY: !hasControls,
100
+ hoverCursor: hasControls ? 'move' : 'pointer',
101
+ };
102
+ }
103
+ else {
104
+ option = {
105
+ anime: null,
106
+ hasControls: false,
107
+ lockMovementX: true,
108
+ lockMovementY: true,
109
+ hoverCursor: 'pointer',
110
+ };
111
+ }
112
+ animejs_1.default.remove(obj);
113
+ const { type } = obj.animation;
114
+ if (type === 'fade') {
115
+ Object.assign(option, {
116
+ opacity: obj.originOpacity,
117
+ originOpacity: null,
118
+ });
119
+ }
120
+ else if (type === 'bounce') {
121
+ if (obj.animation.bounce === 'vertical') {
122
+ Object.assign(option, {
123
+ top: obj.originTop,
124
+ originTop: null,
125
+ });
126
+ }
127
+ else {
128
+ Object.assign(option, {
129
+ left: obj.originLeft,
130
+ originLeft: null,
131
+ });
132
+ }
133
+ }
134
+ else if (type === 'shake') {
135
+ if (obj.animation.shake === 'vertical') {
136
+ Object.assign(option, {
137
+ top: obj.originTop,
138
+ originTop: null,
139
+ });
140
+ }
141
+ else {
142
+ Object.assign(option, {
143
+ left: obj.originLeft,
144
+ originLeft: null,
145
+ });
146
+ }
147
+ }
148
+ else if (type === 'scaling') {
149
+ Object.assign(option, {
150
+ scaleX: obj.originScaleX,
151
+ scaleY: obj.originScaleY,
152
+ originScaleX: null,
153
+ originScaleY: null,
154
+ });
155
+ }
156
+ else if (type === 'rotation') {
157
+ Object.assign(option, {
158
+ angle: obj.originAngle,
159
+ rotation: obj.originAngle,
160
+ left: obj.originLeft,
161
+ top: obj.originTop,
162
+ originLeft: null,
163
+ originTop: null,
164
+ originAngle: null,
165
+ });
166
+ }
167
+ else if (type === 'flash') {
168
+ if (obj.type === 'svg') {
169
+ obj._objects.forEach(child => this.handler.setByPartial(child, {
170
+ fill: child.originFill,
171
+ stroke: child.originStroke,
172
+ originFill: null,
173
+ originStroke: null,
174
+ }));
175
+ }
176
+ Object.assign(option, {
177
+ fill: obj.originFill,
178
+ stroke: obj.originStroke,
179
+ originFill: null,
180
+ originStroke: null,
181
+ });
182
+ }
183
+ else {
184
+ console.warn('Not supported type.');
185
+ }
186
+ obj.set(option);
187
+ this.handler.canvas.renderAll();
188
+ };
189
+ /**
190
+ * Get animation option
191
+ *
192
+ * @param {FabricObject} obj
193
+ * @param {boolean} [hasControls]
194
+ * @returns
195
+ */
196
+ this.getAnime = (obj, hasControls) => {
197
+ const { delay = 0, duration = 100, autoplay = true, loop = true, type, ...other } = obj.animation;
198
+ const option = {
199
+ targets: obj,
200
+ delay,
201
+ loop,
202
+ autoplay,
203
+ duration,
204
+ direction: 'alternate',
205
+ begin: () => {
206
+ obj.set({
207
+ hasControls: false,
208
+ lockMovementX: true,
209
+ lockMovementY: true,
210
+ hoverCursor: 'pointer',
211
+ });
212
+ this.handler.canvas.requestRenderAll();
213
+ },
214
+ update: (instance) => {
215
+ if (type === 'flash') {
216
+ // I don't know why it works. Magic code...
217
+ warning_1.default(instance.animations[0], 'instance.animations[0] undefined.');
218
+ warning_1.default(instance.animations[1], 'instance.animations[1] undefined.');
219
+ const fill = instance.animations[0]?.currentValue;
220
+ const stroke = instance.animations[1]?.currentValue;
221
+ if (obj.type === 'svg') {
222
+ obj.setFill(fill);
223
+ obj.setStroke(stroke);
224
+ }
225
+ else {
226
+ obj.set('fill', '');
227
+ obj.set('fill', fill);
228
+ obj.set('stroke', stroke);
229
+ }
230
+ }
231
+ else if (type === 'rotation') {
232
+ let angle = instance.animations[0].currentValue;
233
+ if (typeof angle === 'string') {
234
+ angle = parseInt(angle, 10);
235
+ }
236
+ obj.rotate(angle);
237
+ this.handler.canvas.requestRenderAll();
238
+ return;
239
+ }
240
+ obj.setCoords();
241
+ this.handler.canvas.requestRenderAll();
242
+ },
243
+ complete: () => {
244
+ this.resetAnimation(obj, hasControls);
245
+ },
246
+ };
247
+ if (type === 'fade') {
248
+ const { opacity = 0 } = other;
249
+ obj.set('originOpacity', obj.opacity);
250
+ Object.assign(option, {
251
+ opacity,
252
+ easing: 'easeInQuad',
253
+ });
254
+ }
255
+ else if (type === 'bounce') {
256
+ const { offset = 1 } = other;
257
+ if (other.bounce === 'vertical') {
258
+ obj.set('originTop', obj.top);
259
+ Object.assign(option, {
260
+ top: obj.top + offset,
261
+ easing: 'easeInQuad',
262
+ });
263
+ }
264
+ else {
265
+ obj.set('originLeft', obj.left);
266
+ Object.assign(option, {
267
+ left: obj.left + offset,
268
+ easing: 'easeInQuad',
269
+ });
270
+ }
271
+ }
272
+ else if (type === 'shake') {
273
+ const { offset = 1 } = other;
274
+ if (other.shake === 'vertical') {
275
+ obj.set('originTop', obj.top);
276
+ Object.assign(option, {
277
+ top: obj.top + offset,
278
+ delay: 0,
279
+ elasticity: 1000,
280
+ duration: 500,
281
+ });
282
+ }
283
+ else {
284
+ obj.set('originLeft', obj.left);
285
+ Object.assign(option, {
286
+ left: obj.left + offset,
287
+ delay: 0,
288
+ elasticity: 1000,
289
+ duration: 500,
290
+ });
291
+ }
292
+ }
293
+ else if (type === 'scaling') {
294
+ const { scale = 2 } = other;
295
+ obj.set('originScaleX', obj.scaleX);
296
+ obj.set('originScaleY', obj.scaleY);
297
+ obj.set({
298
+ originScaleX: obj.scaleX,
299
+ originScaleY: obj.scaleY,
300
+ });
301
+ const scaleX = obj.scaleX * scale;
302
+ const scaleY = obj.scaleY * scale;
303
+ Object.assign(option, {
304
+ scaleX,
305
+ scaleY,
306
+ easing: 'easeInQuad',
307
+ });
308
+ }
309
+ else if (type === 'rotation') {
310
+ const { angle = 360 } = other;
311
+ obj.set('rotation', obj.angle);
312
+ obj.set('originAngle', obj.angle);
313
+ obj.set('originLeft', obj.left);
314
+ obj.set('originTop', obj.top);
315
+ Object.assign(option, {
316
+ rotation: angle,
317
+ easing: 'linear',
318
+ direction: 'normal',
319
+ });
320
+ }
321
+ else if (type === 'flash') {
322
+ const { fill = obj.fill, stroke = obj.stroke } = other;
323
+ if (obj.type === 'svg') {
324
+ obj._objects.forEach(child => this.handler.setByPartial(child, {
325
+ originFill: child.fill,
326
+ originStroke: child.stroke,
327
+ }));
328
+ }
329
+ obj.set('originFill', obj.fill);
330
+ obj.set('originStroke', obj.stroke);
331
+ Object.assign(option, {
332
+ fill,
333
+ stroke,
334
+ easing: 'easeInQuad',
335
+ });
336
+ }
337
+ else {
338
+ console.warn('Not supported type.');
339
+ return null;
340
+ }
341
+ return animejs_1.default(option);
342
+ };
343
+ this.handler = handler;
344
+ }
345
+ }
346
+ exports.default = AnimationHandler;