customized-fabric 1.4.5 → 1.4.7

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,8 +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
+ type: this.imageType,
155
+ color: this.imageColor,
156
156
  };
157
157
  }
158
158
  else {
@@ -227,7 +227,7 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
227
227
  const loadedImage = await (0, utils_1.loadImageFromUrl)(url);
228
228
  if (loadedImage) {
229
229
  const mask = await this.getMask();
230
- const { top, left, scaleX, width, angle } = data;
230
+ const { top, left, scaleX, width, angle, color, type } = data;
231
231
  const ratioWidth = (width * scaleX) / (clipPath.width * clipPath.scaleX);
232
232
  const ratioPosition = this.width / clipPath.width;
233
233
  loadedImage.scaleToWidth(ratioWidth * this.width);
@@ -238,7 +238,9 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
238
238
  originX: "center",
239
239
  originY: "center",
240
240
  clipPath: mask,
241
- filters: this.imageFilters ?? [],
241
+ filters: type
242
+ ? (0, utils_1.getImageFilters)(type, { color })
243
+ : this.imageFilters,
242
244
  });
243
245
  loadedImage.applyFilters();
244
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.5",
3
+ "version": "1.4.7",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",