react-design-editor 0.0.44 → 0.0.45

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.
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const animejs_1 = __importDefault(require("animejs"));
7
+ const warning_1 = __importDefault(require("warning"));
7
8
  class AnimationHandler {
8
9
  constructor(handler) {
9
10
  /**
@@ -164,6 +165,14 @@ class AnimationHandler {
164
165
  });
165
166
  }
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
+ }
167
176
  Object.assign(option, {
168
177
  fill: obj.originFill,
169
178
  stroke: obj.originStroke,
@@ -205,8 +214,10 @@ class AnimationHandler {
205
214
  update: (instance) => {
206
215
  if (type === 'flash') {
207
216
  // I don't know why it works. Magic code...
208
- const fill = instance.animations[0].currentValue;
209
- const stroke = instance.animations[1].currentValue;
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;
210
221
  if (obj.type === 'svg') {
211
222
  obj.setFill(fill);
212
223
  obj.setStroke(stroke);
@@ -309,6 +320,12 @@ class AnimationHandler {
309
320
  }
310
321
  else if (type === 'flash') {
311
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
+ }
312
329
  obj.set('originFill', obj.fill);
313
330
  obj.set('originStroke', obj.stroke);
314
331
  Object.assign(option, {
@@ -81,9 +81,10 @@ export declare type FabricObjectOption<T extends any = fabric.IObjectOptions> =
81
81
  originAngle?: number;
82
82
  /**
83
83
  * Original fill color
84
- * @type {(string | fabric.Pattern)}
84
+ *
85
+ * @type {(string | fabric.Pattern | fabric.Gradient)}
85
86
  */
86
- originFill?: string | fabric.Pattern;
87
+ originFill?: string | fabric.Pattern | fabric.Gradient;
87
88
  /**
88
89
  * Original stroke color
89
90
  * @type {string}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-design-editor",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "Design Editor Tools with React.js + ant.design + fabric.js",
5
5
  "main": "dist/react-design-editor.min.js",
6
6
  "typings": "lib/index.d.ts",