leafer-draw 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$4 = Debug.get("LeaferCanvas");
7085
7085
 
@@ -9464,11 +9464,16 @@ let Polygon = class Polygon extends UI {
9464
9464
  if (data.points) {
9465
9465
  drawPoints$1(path, data.points, data.curve, data.closed);
9466
9466
  } else {
9467
- const {width: width, height: height, sides: sides} = data;
9467
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9468
9468
  const rx = width / 2, ry = height / 2;
9469
- moveTo$2(path, rx, 0);
9469
+ let startRadian = 0, radian;
9470
+ if (startAngle) {
9471
+ startRadian = startAngle * OneRadian;
9472
+ moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9473
+ } else moveTo$2(path, rx, 0);
9470
9474
  for (let i = 1; i < sides; i++) {
9471
- lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9475
+ radian = i * 2 * PI$1 / sides + startRadian;
9476
+ lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
9472
9477
  }
9473
9478
  closePath$1(path);
9474
9479
  }
@@ -9479,6 +9484,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9479
9484
 
9480
9485
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9481
9486
 
9487
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9488
+
9482
9489
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9483
9490
 
9484
9491
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9494,12 +9501,17 @@ let Star = class Star extends UI {
9494
9501
  return "Star";
9495
9502
  }
9496
9503
  __updatePath() {
9497
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9504
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9498
9505
  const rx = width / 2, ry = height / 2;
9499
9506
  const path = this.__.path = [];
9500
- moveTo$1(path, rx, 0);
9507
+ let startRadian = 0, radian;
9508
+ if (startAngle) {
9509
+ startRadian = startAngle * OneRadian;
9510
+ moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
9511
+ } else moveTo$1(path, rx, 0);
9501
9512
  for (let i = 1; i < corners * 2; i++) {
9502
- 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));
9513
+ radian = i * PI / corners + startRadian;
9514
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
9503
9515
  }
9504
9516
  closePath(path);
9505
9517
  }
@@ -9511,6 +9523,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9511
9523
 
9512
9524
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9513
9525
 
9526
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9527
+
9514
9528
  Star = __decorate([ registerUI() ], Star);
9515
9529
 
9516
9530
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -9869,7 +9883,8 @@ let Pen = class Pen extends Group {
9869
9883
  return this;
9870
9884
  }
9871
9885
  paint() {
9872
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
9886
+ const {pathElement: pathElement} = this;
9887
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
9873
9888
  }
9874
9889
  };
9875
9890
 
@@ -9953,6 +9968,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
9953
9968
  if (!data.__strokeWidth) return;
9954
9969
  if (data.__font) {
9955
9970
  Paint.strokeText(stroke, ui, canvas, renderOptions);
9971
+ } else if (data.__pathForStroke) {
9972
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
9956
9973
  } else {
9957
9974
  switch (data.strokeAlign) {
9958
9975
  case "center":