customized-fabric 1.5.4 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -140,13 +140,15 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
140
140
  },
141
141
  setSizes: function (options) {
142
142
  const { width, height } = options;
143
- if (width && width > this.textObject.__lineWidths) {
143
+ if (width) {
144
144
  this.set({ width });
145
- this.textObject.set({ width });
145
+ this.rectObject.set({ width });
146
146
  }
147
- if (height && height > this.textObject.height) {
147
+ if (height) {
148
148
  this.set({ height });
149
+ this.rectObject.set({ height });
149
150
  }
151
+ this.calculateTextPath(this.width, this.height);
150
152
  this.canvas?.renderAll?.();
151
153
  },
152
154
  setTextAttributes: function (options) {
@@ -177,9 +179,12 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
177
179
  });
178
180
  this.pathObject = path;
179
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;
180
184
  this.textObject.set({
181
185
  path,
182
- pathLength: pathInfo?.[(pathInfo?.length ?? 0) - 1]?.length,
186
+ pathLength,
187
+ pathStartOffset: (position * pathLength) / 360,
183
188
  });
184
189
  },
185
190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",