customized-fabric 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,15 +44,19 @@ const ClipartClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group, {
44
44
  layerId: options?.personalizeId ?? options?.layerId,
45
45
  objectCaching: false,
46
46
  });
47
- if (options?.isOriginal) {
47
+ const { isOriginal, hideStroke, clipartFile, clipartUrl } = options ?? {};
48
+ if (isOriginal) {
48
49
  this.rectObject?.set({ strokeWidth: 0 });
49
50
  }
50
51
  else {
51
- if (options?.hideStroke) {
52
+ if (hideStroke) {
52
53
  this.rectObject?.set({ strokeWidth: 0 });
53
54
  }
54
- if (options?.clipartFile || options?.clipartUrl) {
55
- this.loadImage(options?.clipartFile ?? options.clipartUrl);
55
+ if (clipartFile) {
56
+ this.loadImage(clipartFile);
57
+ }
58
+ else if (!clipartUrl?.endsWith("/")) {
59
+ this.loadImage(clipartUrl);
56
60
  }
57
61
  }
58
62
  },
@@ -54,8 +54,8 @@ const CurvedTextClass = fabric_1.fabric.util.createClass(fabric_1.fabric.Group,
54
54
  };
55
55
  this.set(attributes);
56
56
  this.rectObject.set(attributes);
57
- this.calculateTextPath(width, height);
58
57
  this.autoChangeFontSize(0.1);
58
+ this.calculateTextPath(width, height);
59
59
  this.canvas?.renderAll?.();
60
60
  });
61
61
  if (options?.isOriginal) {
@@ -19,6 +19,7 @@ export interface ICurvedTextOptions extends fabric.IGroupOptions {
19
19
  infix?: string;
20
20
  suffix?: string;
21
21
  lengthRatio?: number;
22
+ positionAngle?: number;
22
23
  isAllCapital?: boolean;
23
24
  };
24
25
  fontUrl?: string;
package/lib/index.d.ts CHANGED
@@ -8,4 +8,5 @@ import QRCode from "./QRCodeObject";
8
8
  import fabric, { lockObject, lockAllObjects, loadImageFromFile, loadImageFromUrl, getObject, asyncGetObject } from "./utils";
9
9
  import { OBJECT_TYPES } from "./constants";
10
10
  import { IMAGE_FILTER_TYPES } from "./ImagePlaceholderObject/constants";
11
- export { fabric, TextInput, Clipart, ImagePlaceholder, LayoutGroup, CurvedText, Calendar, QRCode, lockObject, lockAllObjects, loadImageFromFile, loadImageFromUrl, getObject, asyncGetObject, OBJECT_TYPES, IMAGE_FILTER_TYPES, };
11
+ import { IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES } from "./ImagePlaceholderObject/constants";
12
+ export { fabric, TextInput, Clipart, ImagePlaceholder, LayoutGroup, CurvedText, Calendar, QRCode, lockObject, lockAllObjects, loadImageFromFile, loadImageFromUrl, getObject, asyncGetObject, OBJECT_TYPES, IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES, IMAGE_FILTER_TYPES, };
package/lib/index.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.IMAGE_FILTER_TYPES = exports.OBJECT_TYPES = exports.asyncGetObject = exports.getObject = exports.loadImageFromUrl = exports.loadImageFromFile = exports.lockAllObjects = exports.lockObject = exports.QRCode = exports.Calendar = exports.CurvedText = exports.LayoutGroup = exports.ImagePlaceholder = exports.Clipart = exports.TextInput = exports.fabric = void 0;
29
+ exports.IMAGE_FILTER_TYPES = exports.IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES = exports.OBJECT_TYPES = exports.asyncGetObject = exports.getObject = exports.loadImageFromUrl = exports.loadImageFromFile = exports.lockAllObjects = exports.lockObject = exports.QRCode = exports.Calendar = exports.CurvedText = exports.LayoutGroup = exports.ImagePlaceholder = exports.Clipart = exports.TextInput = exports.fabric = void 0;
30
30
  const TextInputObject_1 = __importDefault(require("./TextInputObject"));
31
31
  exports.TextInput = TextInputObject_1.default;
32
32
  const CurvedTextObject_1 = __importDefault(require("./CurvedTextObject"));
@@ -53,3 +53,5 @@ const constants_1 = require("./constants");
53
53
  Object.defineProperty(exports, "OBJECT_TYPES", { enumerable: true, get: function () { return constants_1.OBJECT_TYPES; } });
54
54
  const constants_2 = require("./ImagePlaceholderObject/constants");
55
55
  Object.defineProperty(exports, "IMAGE_FILTER_TYPES", { enumerable: true, get: function () { return constants_2.IMAGE_FILTER_TYPES; } });
56
+ const constants_3 = require("./ImagePlaceholderObject/constants");
57
+ Object.defineProperty(exports, "IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES", { enumerable: true, get: function () { return constants_3.IMAGE_PLACEHOLDER_OBJECT_ATTRIBUTES; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "customized-fabric",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Customized fabric",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",