customized-fabric 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,9 +48,12 @@ const ClipartClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
48
48
  objectCaching: false,
49
49
  });
50
50
  if (options?.isOriginal) {
51
- this.rectObject.set({ strokeWidth: 0 });
51
+ this.rectObject?.set({ strokeWidth: 0 });
52
52
  }
53
53
  else {
54
+ if (options?.hideStroke) {
55
+ this.rectObject?.set({ strokeWidth: 0 });
56
+ }
54
57
  if (options?.clipartFile || options?.clipartUrl) {
55
58
  this.loadImage(options?.clipartFile ?? options.clipartUrl);
56
59
  }
@@ -7,4 +7,5 @@ export interface IClipartOptions extends fabric.IGroupOptions {
7
7
  clipartFile?: File;
8
8
  isOriginal?: boolean;
9
9
  isAdditional?: boolean;
10
+ hideStroke?: boolean;
10
11
  }
@@ -37,9 +37,12 @@ const ImagePlaceholderClass = fabric_1.fabric.util.createClass(fabric_1.fabric.G
37
37
  this.loadImage(options?.imageFile);
38
38
  }
39
39
  if (options?.isOriginal) {
40
- this.rectObject.set({ strokeWidth: 0 });
40
+ this.rectObject?.set({ strokeWidth: 0 });
41
41
  }
42
42
  else {
43
+ if (options?.hideStroke) {
44
+ this.rectObject?.set({ strokeWidth: 0 });
45
+ }
43
46
  if (options?.maskFile || options?.maskUrl) {
44
47
  this.loadMask(options?.maskFile ?? options?.maskUrl);
45
48
  }
@@ -48,5 +48,6 @@ export interface IImagePlaceholderOptions extends fabric.IGroupOptions {
48
48
  image?: IImageOptions;
49
49
  maskUrl?: string;
50
50
  maskFile?: File;
51
+ hideStroke?: boolean;
51
52
  }
52
53
  export declare type ImageFilterType = "Full color" | "Grayscale" | "Blend color";
@@ -56,9 +56,12 @@ const TextInputClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
56
56
  width: this.width,
57
57
  });
58
58
  if (options?.isOriginal) {
59
- this.rectObject.set({ strokeWidth: 0 });
59
+ this.rectObject?.set({ strokeWidth: 0 });
60
60
  }
61
61
  else {
62
+ if (options?.hideStroke) {
63
+ this.rectObject?.set({ strokeWidth: 0 });
64
+ }
62
65
  if (options?.fontUrl) {
63
66
  (0, utils_1.loadFontFromUrl)(options?.fontUrl, text?.fontFamily ?? "").then(() => {
64
67
  this.canvas?.renderAll?.();
@@ -22,4 +22,5 @@ export interface ITextInputOptions extends fabric.IGroupOptions {
22
22
  fontUrl?: string;
23
23
  isOriginal?: boolean;
24
24
  isAdditional?: boolean;
25
+ hideStroke?: boolean;
25
26
  }
@@ -15,6 +15,7 @@ export declare const lockObject: (object: fabric.Object | any, locked: boolean,
15
15
  export declare const lockAllObjects: (canvas: fabric.Canvas, locked: boolean, selectable?: boolean) => void;
16
16
  export declare const getObject: (object: any, options?: {
17
17
  isOriginal?: boolean;
18
+ hideStroke?: boolean;
18
19
  }) => Clipart | ImagePlaceholder | TextInput | undefined;
19
20
  export declare const asyncGetObject: (object: any, options?: {
20
21
  isOriginal?: boolean;
@@ -130,24 +130,21 @@ const getObject = (object, options) => {
130
130
  case constants_1.OBJECT_TYPES.textInput: {
131
131
  const textInputObject = new TextInputObject_1.default({
132
132
  ...object,
133
- isOriginal: options?.isOriginal,
133
+ ...options,
134
134
  });
135
135
  return textInputObject;
136
136
  }
137
137
  case constants_1.OBJECT_TYPES.clipart: {
138
138
  const clipartObject = new ClipartObject_1.default({
139
139
  ...object,
140
- isOriginal: options?.isOriginal,
140
+ ...options,
141
141
  });
142
- if (object?.clipartUrl) {
143
- clipartObject?.loadImage?.(object?.clipartUrl);
144
- }
145
142
  return clipartObject;
146
143
  }
147
144
  case constants_1.OBJECT_TYPES.imagePlaceHolder: {
148
145
  const imagePlaceHolderObject = new ImagePlaceholderObject_1.default({
149
146
  ...object,
150
- isOriginal: options?.isOriginal,
147
+ ...options,
151
148
  });
152
149
  return imagePlaceHolderObject;
153
150
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",