customized-fabric 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -33,9 +33,6 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
|
|
33
33
|
imageType: "Full color",
|
34
34
|
objectCaching: false,
|
35
35
|
});
|
36
|
-
if (options?.imageFile) {
|
37
|
-
this.loadImage(options?.imageFile);
|
38
|
-
}
|
39
36
|
if (options?.isOriginal) {
|
40
37
|
this.rectObject?.set({ strokeWidth: 0 });
|
41
38
|
}
|
@@ -43,8 +40,13 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
|
|
43
40
|
if (options?.hideStroke) {
|
44
41
|
this.rectObject?.set({ strokeWidth: 0 });
|
45
42
|
}
|
46
|
-
|
47
|
-
|
43
|
+
else {
|
44
|
+
if (options?.maskFile || options?.maskUrl) {
|
45
|
+
this.loadMask(options?.maskFile ?? options?.maskUrl);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
if (options?.imageFile) {
|
49
|
+
this.loadImage(options?.imageFile);
|
48
50
|
}
|
49
51
|
}
|
50
52
|
if (options?.imageType) {
|
@@ -178,14 +180,14 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
|
|
178
180
|
this.canvas?.renderAll();
|
179
181
|
},
|
180
182
|
getMask: async function () {
|
181
|
-
if (this.
|
182
|
-
return this.
|
183
|
+
if (this.mask) {
|
184
|
+
return this.mask;
|
183
185
|
}
|
184
186
|
if (this?.maskUrl) {
|
185
|
-
const
|
186
|
-
|
187
|
-
scaleX: this.width / (
|
188
|
-
scaleY: this.height / (
|
187
|
+
const mask = await (0, utils_1.loadImageFromUrl)(this.maskUrl);
|
188
|
+
mask?.set({
|
189
|
+
scaleX: this.width / (mask?.width ?? this.width),
|
190
|
+
scaleY: this.height / (mask?.height ?? this.height),
|
189
191
|
absolutePositioned: true,
|
190
192
|
originX: "center",
|
191
193
|
originY: "center",
|
@@ -193,11 +195,11 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
|
|
193
195
|
left: this.left,
|
194
196
|
angle: this.angle,
|
195
197
|
});
|
196
|
-
this.
|
197
|
-
return
|
198
|
+
this.mask = mask;
|
199
|
+
return mask;
|
198
200
|
}
|
199
201
|
else {
|
200
|
-
const
|
202
|
+
const mask = new fabric_1.fabric.Rect({
|
201
203
|
width: this.width,
|
202
204
|
height: this.height,
|
203
205
|
scaleX: this.scaleX,
|
@@ -209,8 +211,8 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
|
|
209
211
|
left: this.left,
|
210
212
|
angle: this.angle,
|
211
213
|
});
|
212
|
-
this.
|
213
|
-
return
|
214
|
+
this.mask = mask;
|
215
|
+
return mask;
|
214
216
|
}
|
215
217
|
},
|
216
218
|
loadCustomizedImage: async function (image) {
|