customized-fabric 1.7.0 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,6 +32,7 @@ export declare const toCurvedTextObject: (object: CurvedText) => {
32
32
  curvedWidth: any;
33
33
  pathSide: any;
34
34
  pathStartOffset: any;
35
+ isAllCapital: any;
35
36
  };
36
37
  };
37
38
  export default class CurvedText extends fabric.Group {
@@ -27,6 +27,7 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
27
27
  ...text,
28
28
  text: prefix + infix + suffix,
29
29
  fontFamily: "",
30
+ paintFirst: "stroke",
30
31
  });
31
32
  const group = new fabric_1.fabric.Group([this.rectObject, this.textObject]);
32
33
  this.set(group);
@@ -110,7 +111,9 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
110
111
  },
111
112
  getText: function () {
112
113
  const { prefix = "", infix = "", suffix = "" } = this.textObject;
113
- this.setText(infix?.length > 0 ? prefix + infix + suffix : "");
114
+ const isAllCapital = this.textObject.isAllCapital;
115
+ const text = prefix + infix + suffix;
116
+ this.setText(infix?.length > 0 ? (isAllCapital ? text.toUpperCase() : text) : "");
114
117
  },
115
118
  setMaxFontSize: function (fontSize) {
116
119
  this.textObject.set({
@@ -224,6 +227,7 @@ const toCurvedTextObject = (object) => {
224
227
  curvedWidth: textObject?.curvedWidth,
225
228
  pathSide: textObject?.pathSide,
226
229
  pathStartOffset: textObject?.pathStartOffset,
230
+ isAllCapital: textObject?.isAllCapital,
227
231
  },
228
232
  };
229
233
  };
@@ -10,7 +10,7 @@ export interface ICurvedTextOptions extends fabric.IGroupOptions {
10
10
  height?: number;
11
11
  textAlign?: string;
12
12
  fontWeight?: string;
13
- text: string;
13
+ text?: string;
14
14
  fontFamily?: string;
15
15
  maxFontSize: number;
16
16
  stroke?: string;
@@ -19,6 +19,7 @@ export interface ICurvedTextOptions extends fabric.IGroupOptions {
19
19
  infix?: string;
20
20
  suffix?: string;
21
21
  curvedWidth?: number;
22
+ isAllCapital?: boolean;
22
23
  };
23
24
  fontUrl?: string;
24
25
  isOriginal?: boolean;
@@ -29,6 +29,7 @@ export declare const toTextInputObject: (object: TextInput) => {
29
29
  prefix: any;
30
30
  infix: any;
31
31
  suffix: any;
32
+ isAllCapital: any;
32
33
  };
33
34
  };
34
35
  export default class TextInput extends fabric.Group {
@@ -26,6 +26,7 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
26
26
  ...text,
27
27
  text: prefix + infix + suffix,
28
28
  fontFamily: "",
29
+ paintFirst: "stroke",
29
30
  });
30
31
  const group = new fabric_1.fabric.Group([this.rectObject, this.textObject]);
31
32
  this.set(group);
@@ -116,7 +117,9 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
116
117
  },
117
118
  getText: function () {
118
119
  const { prefix = "", infix = "", suffix = "" } = this.textObject;
119
- this.setText(infix?.length > 0 ? prefix + infix + suffix : "");
120
+ const isAllCapital = this.textObject.isAllCapital;
121
+ const text = prefix + infix + suffix;
122
+ this.setText(infix?.length > 0 ? (isAllCapital ? text.toUpperCase() : text) : "");
120
123
  },
121
124
  setMaxFontSize: function (fontSize) {
122
125
  this.textObject.set({
@@ -204,6 +207,7 @@ const toTextInputObject = (object) => {
204
207
  prefix: textObject?.prefix,
205
208
  infix: textObject?.infix,
206
209
  suffix: textObject?.suffix,
210
+ isAllCapital: textObject?.isAllCapital,
207
211
  },
208
212
  };
209
213
  };
@@ -10,7 +10,7 @@ export interface ITextInputOptions extends fabric.IGroupOptions {
10
10
  height?: number;
11
11
  textAlign?: string;
12
12
  fontWeight?: string;
13
- text: string;
13
+ text?: string;
14
14
  fontFamily?: string;
15
15
  maxFontSize: number;
16
16
  stroke?: string;
@@ -18,6 +18,7 @@ export interface ITextInputOptions extends fabric.IGroupOptions {
18
18
  prefix?: string;
19
19
  infix?: string;
20
20
  suffix?: string;
21
+ isAllCapital?: boolean;
21
22
  };
22
23
  fontUrl?: string;
23
24
  isOriginal?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",