customized-fabric 1.3.8 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -233,27 +233,29 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
233
233
  originX: "center",
234
234
  originY: "center",
235
235
  clipPath: mask,
236
+ filters: this.imageFilters ?? [],
236
237
  });
238
+ loadedImage.applyFilters();
237
239
  return loadedImage;
238
240
  }
239
241
  }
240
242
  }
241
243
  },
242
- setImageType: function (type, options) {
244
+ setImageType: function (type) {
243
245
  this.imageType = type;
244
- this.imageFilters = (0, utils_1.getImageFilters)(type, options);
245
- this.imageObject && this.applyImageFilters(this.imageObject);
246
+ this.imageFilters = (0, utils_1.getImageFilters)(type, { color: this.imageColor });
246
247
  },
247
248
  setImageColor: function (color) {
248
249
  this.imageColor = color;
249
250
  this.imageFilters = (0, utils_1.getImageFilters)(this.imageType, { color });
250
- this.imageObject && this.applyImageFilters(this.imageObject);
251
251
  },
252
252
  applyImageFilters: function (image) {
253
- const imageFilters = this.imageFilters ?? [];
254
- image.filters = imageFilters;
255
- image.applyFilters();
256
- this.canvas.renderAll();
253
+ if (image) {
254
+ const imageFilters = this.imageFilters ?? [];
255
+ image.filters = imageFilters;
256
+ image.applyFilters();
257
+ this.canvas.renderAll();
258
+ }
257
259
  },
258
260
  });
259
261
  const toImagePlaceholderObject = (imagePlaceholderObject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.3.8",
3
+ "version": "1.4.0",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",