customized-fabric 1.3.9 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,8 @@ export default class ImagePlaceholder extends fabric.Group {
|
|
23
23
|
isAdditional?: boolean;
|
24
24
|
imageColor?: string;
|
25
25
|
imageType?: string;
|
26
|
+
imageObject?: fabric.Image;
|
27
|
+
uploadedImage?: fabric.Image;
|
26
28
|
getSettings?: (attribute: string) => any;
|
27
29
|
setSizes?: (options: {
|
28
30
|
width?: number;
|
@@ -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
|
244
|
+
setImageType: function (type) {
|
245
245
|
this.imageType = type;
|
246
|
-
this.imageFilters = (0, utils_1.getImageFilters)(type,
|
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
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
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) => {
|