customized-fabric 1.5.3 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,6 +48,7 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
48
48
  ...rest,
49
49
  layerId: options?.personalizeId ?? options?.layerId,
50
50
  objectCaching: false,
51
+ pathVisible: !(options?.isOriginal || options?.hideStroke),
51
52
  });
52
53
  this.autoChangeFontSize(0.1);
53
54
  this.calculateTextPath(this.width, this.height);
@@ -139,13 +140,15 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
139
140
  },
140
141
  setSizes: function (options) {
141
142
  const { width, height } = options;
142
- if (width && width > this.textObject.__lineWidths) {
143
+ if (width) {
143
144
  this.set({ width });
144
- this.textObject.set({ width });
145
+ this.rectObject.set({ width });
145
146
  }
146
- if (height && height > this.textObject.height) {
147
+ if (height) {
147
148
  this.set({ height });
149
+ this.rectObject.set({ height });
148
150
  }
151
+ this.calculateTextPath(this.width, this.height);
149
152
  this.canvas?.renderAll?.();
150
153
  },
151
154
  setTextAttributes: function (options) {
@@ -172,12 +175,16 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
172
175
  objectCaching: false,
173
176
  originX: "center",
174
177
  originY: "center",
178
+ visible: this.pathVisible,
175
179
  });
176
180
  this.pathObject = path;
177
181
  const pathInfo = fabric_1.fabric.util?.getPathSegmentsInfo?.(path.path);
182
+ const pathLength = pathInfo?.[(pathInfo?.length ?? 0) - 1]?.length;
183
+ const position = this.textObject.position ?? 0;
178
184
  this.textObject.set({
179
185
  path,
180
- pathLength: pathInfo?.[(pathInfo?.length ?? 0) - 1]?.length,
186
+ pathLength,
187
+ pathStartOffset: (position * pathLength) / 360,
181
188
  });
182
189
  },
183
190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",