customized-fabric 1.4.4 → 1.4.6

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.
@@ -151,6 +151,8 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
151
151
  skewX,
152
152
  skewY,
153
153
  opacity,
154
+ type: this.imageType,
155
+ color: this.imageColor,
154
156
  };
155
157
  }
156
158
  else {
@@ -225,7 +227,7 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
225
227
  const loadedImage = await (0, utils_1.loadImageFromUrl)(url);
226
228
  if (loadedImage) {
227
229
  const mask = await this.getMask();
228
- const { top, left, scaleX, width, angle } = data;
230
+ const { top, left, scaleX, width, angle, color, type } = data;
229
231
  const ratioWidth = (width * scaleX) / (clipPath.width * clipPath.scaleX);
230
232
  const ratioPosition = this.width / clipPath.width;
231
233
  loadedImage.scaleToWidth(ratioWidth * this.width);
@@ -236,7 +238,9 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
236
238
  originX: "center",
237
239
  originY: "center",
238
240
  clipPath: mask,
239
- filters: this.imageFilters ?? [],
241
+ filters: color && type
242
+ ? (0, utils_1.getImageFilters)(type, { color })
243
+ : this.imageFilters,
240
244
  });
241
245
  loadedImage.applyFilters();
242
246
  return loadedImage;
@@ -33,6 +33,8 @@ export interface IImageOptions {
33
33
  skewX: number;
34
34
  skewY: number;
35
35
  opacity: number;
36
+ color?: string;
37
+ type?: ImageFilterType;
36
38
  };
37
39
  clipPath: IClipPathOptions;
38
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",