customized-fabric 1.1.9 → 1.2.1
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.
- package/lib/ClipartObject/index.d.ts +1 -0
- package/lib/ClipartObject/index.js +6 -5
- package/lib/ClipartObject/interfaces.d.ts +1 -0
- package/lib/ImagePlaceholderObject/index.d.ts +1 -0
- package/lib/ImagePlaceholderObject/index.js +6 -5
- package/lib/ImagePlaceholderObject/interfaces.d.ts +1 -0
- package/lib/TextInputObject/index.d.ts +7 -0
- package/lib/TextInputObject/index.js +26 -0
- package/lib/TextInputObject/interfaces.d.ts +1 -0
- package/package.json +1 -1
@@ -2,6 +2,7 @@ import { fabric } from "fabric";
|
|
2
2
|
import { IClipartOptions } from "./interfaces";
|
3
3
|
import { ObjectId } from "../utils/objectId";
|
4
4
|
export declare const toClipartObject: (clipartObject: Clipart) => {
|
5
|
+
_id: ObjectId | undefined;
|
5
6
|
id: ObjectId | undefined;
|
6
7
|
personalizeId: number | undefined;
|
7
8
|
layerId: number | undefined;
|
@@ -122,11 +122,12 @@ const ClipartClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
122
122
|
});
|
123
123
|
const toClipartObject = (clipartObject) => {
|
124
124
|
return {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
_id: clipartObject?._id,
|
126
|
+
id: clipartObject?._id,
|
127
|
+
personalizeId: clipartObject?.layerId,
|
128
|
+
layerId: clipartObject?.layerId,
|
129
|
+
name: clipartObject?.name,
|
130
|
+
locked: clipartObject?.locked,
|
130
131
|
isAdditional: clipartObject?.isAdditional,
|
131
132
|
clipartUrl: clipartObject?.clipartUrl,
|
132
133
|
clipartFile: clipartObject?.clipartFile,
|
@@ -2,6 +2,7 @@ import { fabric } from "fabric";
|
|
2
2
|
import { IImagePlaceholderOptions } from "./interfaces";
|
3
3
|
import { ObjectId } from "../utils/objectId";
|
4
4
|
export declare const toImagePlaceholderObject: (imagePlaceholderObject: ImagePlaceholder) => {
|
5
|
+
_id: ObjectId | undefined;
|
5
6
|
id: ObjectId | undefined;
|
6
7
|
personalizeId: number | undefined;
|
7
8
|
layerId: number | undefined;
|
@@ -186,11 +186,12 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
|
|
186
186
|
});
|
187
187
|
const toImagePlaceholderObject = (imagePlaceholderObject) => {
|
188
188
|
return {
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
189
|
+
_id: imagePlaceholderObject?._id,
|
190
|
+
id: imagePlaceholderObject?._id,
|
191
|
+
personalizeId: imagePlaceholderObject?.layerId,
|
192
|
+
layerId: imagePlaceholderObject?.layerId,
|
193
|
+
name: imagePlaceholderObject?.name,
|
194
|
+
locked: imagePlaceholderObject?.locked,
|
194
195
|
isAdditional: imagePlaceholderObject?.isAdditional,
|
195
196
|
};
|
196
197
|
};
|
@@ -2,6 +2,7 @@ import { fabric } from "fabric";
|
|
2
2
|
import { ITextInputOptions } from "./interfaces";
|
3
3
|
import { ObjectId } from "../utils/objectId";
|
4
4
|
export declare const toTextInputObject: (textInputObject: TextInput) => {
|
5
|
+
_id: ObjectId | undefined;
|
5
6
|
id: ObjectId | undefined;
|
6
7
|
personalizeId: number | undefined;
|
7
8
|
layerId: number | undefined;
|
@@ -23,6 +24,9 @@ export declare const toTextInputObject: (textInputObject: TextInput) => {
|
|
23
24
|
maxFontSize: any;
|
24
25
|
stroke: string | undefined;
|
25
26
|
strokeWidth: number | undefined;
|
27
|
+
prefix: any;
|
28
|
+
infix: any;
|
29
|
+
suffix: any;
|
26
30
|
};
|
27
31
|
};
|
28
32
|
export default class TextInput extends fabric.Group {
|
@@ -35,6 +39,9 @@ export default class TextInput extends fabric.Group {
|
|
35
39
|
fontUrl?: string;
|
36
40
|
isAdditional?: boolean;
|
37
41
|
setText?: (text: string) => void;
|
42
|
+
setPrefix?: (text: string) => void;
|
43
|
+
setInfix?: (text: string) => void;
|
44
|
+
setSuffix?: (text: string) => void;
|
38
45
|
setMaxFontSize?: (fontSize: string) => void;
|
39
46
|
setFontFamily?: (fontName: string, fontUrl?: string) => void;
|
40
47
|
setTextAttributes?: (options: fabric.ITextOptions) => void;
|
@@ -94,6 +94,28 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
94
94
|
});
|
95
95
|
this.canvas?.renderAll?.();
|
96
96
|
},
|
97
|
+
setPrefix: function (text) {
|
98
|
+
this.textObject.set({
|
99
|
+
prefix: text,
|
100
|
+
});
|
101
|
+
this.getText();
|
102
|
+
},
|
103
|
+
setInfix: function (text) {
|
104
|
+
this.textObject.set({
|
105
|
+
infix: text,
|
106
|
+
});
|
107
|
+
this.getText();
|
108
|
+
},
|
109
|
+
setSuffix: function (text) {
|
110
|
+
this.textObject.set({
|
111
|
+
suffix: text,
|
112
|
+
});
|
113
|
+
this.getText();
|
114
|
+
},
|
115
|
+
getText: function () {
|
116
|
+
const { prefix = "", infix = "", suffix = "" } = this.textObject;
|
117
|
+
this.setText(infix?.length > 0 ? prefix + infix + suffix : "");
|
118
|
+
},
|
97
119
|
setMaxFontSize: function (fontSize) {
|
98
120
|
this.textObject.set({
|
99
121
|
fontSize,
|
@@ -154,6 +176,7 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
|
|
154
176
|
const toTextInputObject = (textInputObject) => {
|
155
177
|
const textObject = textInputObject.textObject;
|
156
178
|
return {
|
179
|
+
_id: textInputObject?._id,
|
157
180
|
id: textInputObject?._id,
|
158
181
|
personalizeId: textInputObject?.layerId,
|
159
182
|
layerId: textInputObject?.layerId,
|
@@ -175,6 +198,9 @@ const toTextInputObject = (textInputObject) => {
|
|
175
198
|
maxFontSize: textObject?.maxFontSize,
|
176
199
|
stroke: textObject?.stroke,
|
177
200
|
strokeWidth: textObject?.strokeWidth,
|
201
|
+
prefix: textObject?.prefix,
|
202
|
+
infix: textObject?.infix,
|
203
|
+
suffix: textObject?.suffix,
|
178
204
|
},
|
179
205
|
};
|
180
206
|
};
|