react-design-editor 0.0.41 → 0.0.42

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.
@@ -140,15 +140,11 @@ class Handler {
140
140
  if (!activeObject) {
141
141
  return;
142
142
  }
143
- if ((activeObject.type === 'svg' && key === 'fill') || key === 'stroke') {
144
- activeObject.set(key, value);
143
+ if (activeObject.type === 'svg' && (key === 'fill' || key === 'stroke')) {
145
144
  activeObject._objects.forEach(obj => obj.set(key, value));
146
- activeObject.setCoords();
147
- }
148
- else {
149
- activeObject.set(key, value);
150
- activeObject.setCoords();
151
145
  }
146
+ activeObject.set(key, value);
147
+ activeObject.setCoords();
152
148
  this.canvas.requestRenderAll();
153
149
  const { id, superType, type, player, width, height } = activeObject;
154
150
  if (superType === 'element') {
@@ -226,6 +222,14 @@ class Handler {
226
222
  if (!obj) {
227
223
  return;
228
224
  }
225
+ if (obj.type === 'svg') {
226
+ if (key === 'fill') {
227
+ obj.setFill(value);
228
+ }
229
+ else if (key === 'stroke') {
230
+ obj.setStroke(value);
231
+ }
232
+ }
229
233
  obj.set(key, value);
230
234
  obj.setCoords();
231
235
  this.canvas.renderAll();
@@ -273,6 +277,14 @@ class Handler {
273
277
  if (!obj) {
274
278
  return;
275
279
  }
280
+ if (obj.type === 'svg') {
281
+ if (option.fill) {
282
+ obj.setFill(option.fill);
283
+ }
284
+ else if (option.stroke) {
285
+ obj.setStroke(option.stroke);
286
+ }
287
+ }
276
288
  obj.set(option);
277
289
  obj.setCoords();
278
290
  this.canvas.renderAll();
@@ -59,6 +59,12 @@ const Svg = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
59
59
  }
60
60
  });
61
61
  },
62
+ setFill(value) {
63
+ this.getObjects().forEach((obj) => obj.set('fill', value));
64
+ },
65
+ setStroke(value) {
66
+ this.getObjects().forEach((obj) => obj.set('stroke', value));
67
+ },
62
68
  toObject(propertiesToInclude) {
63
69
  return utils_1.toObject(this, propertiesToInclude, {
64
70
  svg: this.get('svg'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-design-editor",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
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",