leafer-ui 2.0.8 → 2.1.0

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.
@@ -7079,7 +7079,7 @@ class LeafLevelList {
7079
7079
  }
7080
7080
  }
7081
7081
 
7082
- const version = "2.0.8";
7082
+ const version = "2.1.0";
7083
7083
 
7084
7084
  const debug$5 = Debug.get("LeaferCanvas");
7085
7085
 
@@ -8279,8 +8279,8 @@ class UIData extends LeafData {
8279
8279
  return this.__getRealStrokeWidth();
8280
8280
  }
8281
8281
  get __maxStrokeWidth() {
8282
- const t = this;
8283
- return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth;
8282
+ const t = this, strokeWidth = t.__hasStrokeSides || t.strokeWidth;
8283
+ return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, strokeWidth) : strokeWidth;
8284
8284
  }
8285
8285
  get __hasMultiPaint() {
8286
8286
  const t = this;
@@ -8381,6 +8381,10 @@ class UIData extends LeafData {
8381
8381
  }
8382
8382
  return strokeWidth;
8383
8383
  }
8384
+ __checkComplex() {
8385
+ const t = this;
8386
+ stintSet$3(t, "__complex", t.__isFills || t.__isStrokes || t.cornerRadius || t.__useEffect);
8387
+ }
8384
8388
  __setPaint(attrName, value) {
8385
8389
  this.__setInput(attrName, value);
8386
8390
  const layout = this.__leaf.__layout;
@@ -8615,7 +8619,7 @@ const UIRender = {
8615
8619
  data.__useEffect = !!(shadow || otherEffect);
8616
8620
  }
8617
8621
  data.__checkSingle();
8618
- stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8622
+ data.__checkComplex();
8619
8623
  },
8620
8624
  __drawFast(canvas, options) {
8621
8625
  drawFast(this, canvas, options);
@@ -9664,11 +9668,16 @@ let Polygon = class Polygon extends UI {
9664
9668
  if (data.points) {
9665
9669
  drawPoints$1(path, data.points, data.curve, data.closed);
9666
9670
  } else {
9667
- const {width: width, height: height, sides: sides} = data;
9671
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9668
9672
  const rx = width / 2, ry = height / 2;
9669
- moveTo$2(path, rx, 0);
9673
+ let startRadian = 0, radian;
9674
+ if (startAngle) {
9675
+ startRadian = startAngle * OneRadian;
9676
+ moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9677
+ } else moveTo$2(path, rx, 0);
9670
9678
  for (let i = 1; i < sides; i++) {
9671
- lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9679
+ radian = i * 2 * PI$1 / sides + startRadian;
9680
+ lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
9672
9681
  }
9673
9682
  closePath$1(path);
9674
9683
  }
@@ -9679,6 +9688,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9679
9688
 
9680
9689
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9681
9690
 
9691
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9692
+
9682
9693
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9683
9694
 
9684
9695
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9694,12 +9705,17 @@ let Star = class Star extends UI {
9694
9705
  return "Star";
9695
9706
  }
9696
9707
  __updatePath() {
9697
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9708
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9698
9709
  const rx = width / 2, ry = height / 2;
9699
9710
  const path = this.__.path = [];
9700
- moveTo$1(path, rx, 0);
9711
+ let startRadian = 0, radian;
9712
+ if (startAngle) {
9713
+ startRadian = startAngle * OneRadian;
9714
+ moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
9715
+ } else moveTo$1(path, rx, 0);
9701
9716
  for (let i = 1; i < corners * 2; i++) {
9702
- lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9717
+ radian = i * PI / corners + startRadian;
9718
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
9703
9719
  }
9704
9720
  closePath(path);
9705
9721
  }
@@ -9711,6 +9727,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9711
9727
 
9712
9728
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9713
9729
 
9730
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9731
+
9714
9732
  Star = __decorate([ registerUI() ], Star);
9715
9733
 
9716
9734
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -10069,7 +10087,8 @@ let Pen = class Pen extends Group {
10069
10087
  return this;
10070
10088
  }
10071
10089
  paint() {
10072
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
10090
+ const {pathElement: pathElement} = this;
10091
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
10073
10092
  }
10074
10093
  };
10075
10094
 
@@ -10311,7 +10330,7 @@ const DragBoundsHelper = {
10311
10330
  return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
10312
10331
  },
10313
10332
  isInnerMode(content, dragBounds, dragBoundsType, sideType) {
10314
- return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
10333
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && float(content[sideType]) > float(dragBounds[sideType]);
10315
10334
  },
10316
10335
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
10317
10336
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
@@ -12002,6 +12021,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
12002
12021
  if (!data.__strokeWidth) return;
12003
12022
  if (data.__font) {
12004
12023
  Paint.strokeText(stroke, ui, canvas, renderOptions);
12024
+ } else if (data.__pathForStroke) {
12025
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
12005
12026
  } else {
12006
12027
  switch (data.strokeAlign) {
12007
12028
  case "center":