customized-fabric 1.3.9 → 1.4.0

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