customized-fabric 1.5.5 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -180,12 +180,16 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
180
180
  this.pathObject = path;
181
181
  const pathInfo = fabric_1.fabric.util?.getPathSegmentsInfo?.(path.path);
182
182
  const pathLength = pathInfo?.[(pathInfo?.length ?? 0) - 1]?.length;
183
- const position = this.textObject.position ?? 0;
184
183
  this.textObject.set({
185
184
  path,
186
185
  pathLength,
187
- pathStartOffset: (position * pathLength) / 360,
188
186
  });
187
+ const position = this.textObject.position;
188
+ if (position) {
189
+ this.textObject.set({
190
+ pathStartOffset: (position * pathLength) / 360,
191
+ });
192
+ }
189
193
  },
190
194
  });
191
195
  const toCurvedTextObject = (object) => {
@@ -1 +1,3 @@
1
+ import { fabric } from "fabric";
1
2
  export declare const getEllipsePath: (rx: number, ry: number) => string;
3
+ export declare const getPathLenght: (path: fabric.Path) => any;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEllipsePath = void 0;
3
+ exports.getPathLenght = exports.getEllipsePath = void 0;
4
+ const fabric_1 = require("fabric");
4
5
  const getEllipsePath = (rx, ry) => {
5
6
  let output = `M 0,0`;
6
7
  output += `a ${rx},${ry} 0 0,1 0,${ry * -2}`;
@@ -9,3 +10,9 @@ const getEllipsePath = (rx, ry) => {
9
10
  return output;
10
11
  };
11
12
  exports.getEllipsePath = getEllipsePath;
13
+ const getPathLenght = (path) => {
14
+ const pathInfo = fabric_1.fabric.util?.getPathSegmentsInfo?.(path.path);
15
+ const pathLength = pathInfo?.[(pathInfo?.length ?? 0) - 1]?.length;
16
+ return pathLength;
17
+ };
18
+ exports.getPathLenght = getPathLenght;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",