@leafer-draw/worker 2.2.5 → 2.2.6

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.
package/dist/worker.js CHANGED
@@ -1814,7 +1814,7 @@ var LeaferUI = function(exports) {
1814
1814
  return name;
1815
1815
  }
1816
1816
  const D$4 = Debug;
1817
- const debug$e = Debug.get("RunTime");
1817
+ const debug$f = Debug.get("RunTime");
1818
1818
  const Run = {
1819
1819
  currentId: 0,
1820
1820
  currentName: "",
@@ -1832,7 +1832,7 @@ var LeaferUI = function(exports) {
1832
1832
  const time = R$1.idMap[id], name = R$1.nameMap[id];
1833
1833
  const duration = microsecond ? (performance.now() - time) / 1e3 : Date.now() - time;
1834
1834
  R$1.idMap[id] = R$1.nameMap[id] = R$1.nameToIdMap[name] = undefined;
1835
- debug$e.log(name, duration, "ms");
1835
+ debug$f.log(name, duration, "ms");
1836
1836
  },
1837
1837
  endOfName(name, microsecond) {
1838
1838
  const id = R$1.nameToIdMap[name];
@@ -1862,17 +1862,17 @@ var LeaferUI = function(exports) {
1862
1862
  return Plugin.need("editor");
1863
1863
  }
1864
1864
  };
1865
- const debug$d = Debug.get("UICreator");
1865
+ const debug$e = Debug.get("UICreator");
1866
1866
  const UICreator = {
1867
1867
  list: {},
1868
1868
  register(UI) {
1869
1869
  const {__tag: tag} = UI.prototype;
1870
- if (list$1[tag]) debug$d.repeat(tag);
1870
+ if (list$1[tag]) debug$e.repeat(tag);
1871
1871
  list$1[tag] = UI;
1872
1872
  },
1873
1873
  get(tag, data, x, y, width, height) {
1874
1874
  if (!list$1[tag]) {
1875
- debug$d.warn("not register " + tag);
1875
+ debug$e.warn("not register " + tag);
1876
1876
  return undefined;
1877
1877
  }
1878
1878
  const ui = new list$1[tag](data);
@@ -1886,14 +1886,14 @@ var LeaferUI = function(exports) {
1886
1886
  }
1887
1887
  };
1888
1888
  const {list: list$1} = UICreator;
1889
- const debug$c = Debug.get("EventCreator");
1889
+ const debug$d = Debug.get("EventCreator");
1890
1890
  const EventCreator = {
1891
1891
  nameList: {},
1892
1892
  register(Event) {
1893
1893
  let name;
1894
1894
  Object.keys(Event).forEach(key => {
1895
1895
  name = Event[key];
1896
- if (isString(name)) nameList[name] && debug$c.repeat(name), nameList[name] = Event;
1896
+ if (isString(name)) nameList[name] && debug$d.repeat(name), nameList[name] = Event;
1897
1897
  });
1898
1898
  },
1899
1899
  changeName(oldName, newName) {
@@ -2807,7 +2807,7 @@ var LeaferUI = function(exports) {
2807
2807
  const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2808
2808
  const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2809
2809
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2810
- const debug$b = Debug.get("PathConvert");
2810
+ const debug$c = Debug.get("PathConvert");
2811
2811
  const setEndPoint$1 = {};
2812
2812
  const PathConvert = {
2813
2813
  current: {
@@ -3072,7 +3072,7 @@ var LeaferUI = function(exports) {
3072
3072
  break;
3073
3073
 
3074
3074
  default:
3075
- debug$b.error(`command: ${command} [index:${i}]`, old);
3075
+ debug$c.error(`command: ${command} [index:${i}]`, old);
3076
3076
  return data;
3077
3077
  }
3078
3078
  lastCommand = command;
@@ -3129,7 +3129,9 @@ var LeaferUI = function(exports) {
3129
3129
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3130
3130
  const {tan: tan, min: min, abs: abs$3} = Math;
3131
3131
  const startPoint = {};
3132
+ const debug$b = Debug.get("PointsCurve");
3132
3133
  const PathCommandDataHelper = {
3134
+ pointsCurveList: {},
3133
3135
  beginPath(data) {
3134
3136
  data.length = 0;
3135
3137
  },
@@ -3199,11 +3201,19 @@ var LeaferUI = function(exports) {
3199
3201
  data.push(M$3, startPoint.x, startPoint.y);
3200
3202
  arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
3201
3203
  },
3202
- drawPoints(data, points, curve, close) {
3203
- BezierHelper.points(data, points, curve, close);
3204
+ drawPoints(data, points, curve, close, options) {
3205
+ let type = "Q";
3206
+ if (isObject(curve)) type = curve.type, curve = curve.value;
3207
+ if (!pointsCurveList[type]) debug$b.warn("not found:", type), type = "Q";
3208
+ pointsCurveList[type](data, points, curve, close, options);
3204
3209
  }
3205
3210
  };
3206
- const {ellipse: ellipse$3, arc: arc$2} = PathCommandDataHelper;
3211
+ const {ellipse: ellipse$3, arc: arc$2, pointsCurveList: pointsCurveList} = PathCommandDataHelper;
3212
+ function registerPointsCurve(type, fn) {
3213
+ if (pointsCurveList[type]) debug$b.repeat(type);
3214
+ pointsCurveList[type] = fn;
3215
+ }
3216
+ registerPointsCurve("Q", BezierHelper.points);
3207
3217
  const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$1, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3208
3218
  class PathCreator {
3209
3219
  set path(value) {
@@ -6606,7 +6616,7 @@ var LeaferUI = function(exports) {
6606
6616
  this.levelMap = null;
6607
6617
  }
6608
6618
  }
6609
- const version = "2.2.5";
6619
+ const version = "2.2.6";
6610
6620
  class LeaferCanvas extends LeaferCanvasBase {
6611
6621
  get allowBackgroundColor() {
6612
6622
  return true;
@@ -7679,7 +7689,7 @@ var LeaferUI = function(exports) {
7679
7689
  }
7680
7690
  if (data.__useEffect) {
7681
7691
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7682
- stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7692
+ stintSet$2(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && !(shadow[0].blendMode && shadow[0].blendMode !== "pass-through") && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7683
7693
  data.__useEffect = !!(shadow || otherEffect);
7684
7694
  }
7685
7695
  data.__checkSingle();
@@ -8611,7 +8621,7 @@ var LeaferUI = function(exports) {
8611
8621
  const data = this.__;
8612
8622
  const path = data.path = [];
8613
8623
  if (data.points) {
8614
- drawPoints$1(path, data.points, data.curve, data.closed);
8624
+ drawPoints$1(path, data.points, data.curve, data.closed, data);
8615
8625
  } else {
8616
8626
  const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
8617
8627
  const rx = width / 2, ry = height / 2;
@@ -8686,7 +8696,7 @@ var LeaferUI = function(exports) {
8686
8696
  const data = this.__;
8687
8697
  const path = data.path = [];
8688
8698
  if (data.points) {
8689
- drawPoints(path, data.points, data.curve, data.closed);
8699
+ drawPoints(path, data.points, data.curve, data.closed, data);
8690
8700
  } else {
8691
8701
  moveTo(path, 0, 0);
8692
8702
  lineTo(path, this.width, 0);
@@ -10649,6 +10659,7 @@ var LeaferUI = function(exports) {
10649
10659
  exports.pathType = pathType;
10650
10660
  exports.pen = pen;
10651
10661
  exports.positionType = positionType;
10662
+ exports.registerPointsCurve = registerPointsCurve;
10652
10663
  exports.registerUI = registerUI;
10653
10664
  exports.registerUIEvent = registerUIEvent;
10654
10665
  exports.resizeType = resizeType;