leafer-ui 2.0.7 → 2.0.9

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.7";
7082
+ const version = "2.0.9";
7083
7083
 
7084
7084
  const debug$5 = Debug.get("LeaferCanvas");
7085
7085
 
@@ -9664,11 +9664,16 @@ let Polygon = class Polygon extends UI {
9664
9664
  if (data.points) {
9665
9665
  drawPoints$1(path, data.points, data.curve, data.closed);
9666
9666
  } else {
9667
- const {width: width, height: height, sides: sides} = data;
9667
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9668
9668
  const rx = width / 2, ry = height / 2;
9669
- moveTo$2(path, rx, 0);
9669
+ let startRadian = 0, radian;
9670
+ if (startAngle) {
9671
+ startRadian = startAngle * OneRadian;
9672
+ moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9673
+ } else moveTo$2(path, rx, 0);
9670
9674
  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));
9675
+ radian = i * 2 * PI$1 / sides + startRadian;
9676
+ lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
9672
9677
  }
9673
9678
  closePath$1(path);
9674
9679
  }
@@ -9679,6 +9684,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9679
9684
 
9680
9685
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9681
9686
 
9687
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9688
+
9682
9689
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9683
9690
 
9684
9691
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9694,12 +9701,17 @@ let Star = class Star extends UI {
9694
9701
  return "Star";
9695
9702
  }
9696
9703
  __updatePath() {
9697
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9704
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9698
9705
  const rx = width / 2, ry = height / 2;
9699
9706
  const path = this.__.path = [];
9700
- moveTo$1(path, rx, 0);
9707
+ let startRadian = 0, radian;
9708
+ if (startAngle) {
9709
+ startRadian = startAngle * OneRadian;
9710
+ moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
9711
+ } else moveTo$1(path, rx, 0);
9701
9712
  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));
9713
+ radian = i * PI / corners + startRadian;
9714
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
9703
9715
  }
9704
9716
  closePath(path);
9705
9717
  }
@@ -9711,6 +9723,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9711
9723
 
9712
9724
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9713
9725
 
9726
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9727
+
9714
9728
  Star = __decorate([ registerUI() ], Star);
9715
9729
 
9716
9730
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -10069,7 +10083,8 @@ let Pen = class Pen extends Group {
10069
10083
  return this;
10070
10084
  }
10071
10085
  paint() {
10072
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
10086
+ const {pathElement: pathElement} = this;
10087
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
10073
10088
  }
10074
10089
  };
10075
10090
 
@@ -10311,7 +10326,7 @@ const DragBoundsHelper = {
10311
10326
  return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
10312
10327
  },
10313
10328
  isInnerMode(content, dragBounds, dragBoundsType, sideType) {
10314
- return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
10329
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && float(content[sideType]) > float(dragBounds[sideType]);
10315
10330
  },
10316
10331
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
10317
10332
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
@@ -12002,6 +12017,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
12002
12017
  if (!data.__strokeWidth) return;
12003
12018
  if (data.__font) {
12004
12019
  Paint.strokeText(stroke, ui, canvas, renderOptions);
12020
+ } else if (data.__pathForStroke) {
12021
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
12005
12022
  } else {
12006
12023
  switch (data.strokeAlign) {
12007
12024
  case "center":