leafer-draw 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$4 = Debug.get("LeaferCanvas");
7085
7085
 
@@ -8079,8 +8079,8 @@ class UIData extends LeafData {
8079
8079
  return this.__getRealStrokeWidth();
8080
8080
  }
8081
8081
  get __maxStrokeWidth() {
8082
- const t = this;
8083
- return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth;
8082
+ const t = this, strokeWidth = t.__hasStrokeSides || t.strokeWidth;
8083
+ return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, strokeWidth) : strokeWidth;
8084
8084
  }
8085
8085
  get __hasMultiPaint() {
8086
8086
  const t = this;
@@ -8181,6 +8181,10 @@ class UIData extends LeafData {
8181
8181
  }
8182
8182
  return strokeWidth;
8183
8183
  }
8184
+ __checkComplex() {
8185
+ const t = this;
8186
+ stintSet$3(t, "__complex", t.__isFills || t.__isStrokes || t.cornerRadius || t.__useEffect);
8187
+ }
8184
8188
  __setPaint(attrName, value) {
8185
8189
  this.__setInput(attrName, value);
8186
8190
  const layout = this.__leaf.__layout;
@@ -8415,7 +8419,7 @@ const UIRender = {
8415
8419
  data.__useEffect = !!(shadow || otherEffect);
8416
8420
  }
8417
8421
  data.__checkSingle();
8418
- stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8422
+ data.__checkComplex();
8419
8423
  },
8420
8424
  __drawFast(canvas, options) {
8421
8425
  drawFast(this, canvas, options);
@@ -9464,11 +9468,16 @@ let Polygon = class Polygon extends UI {
9464
9468
  if (data.points) {
9465
9469
  drawPoints$1(path, data.points, data.curve, data.closed);
9466
9470
  } else {
9467
- const {width: width, height: height, sides: sides} = data;
9471
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9468
9472
  const rx = width / 2, ry = height / 2;
9469
- moveTo$2(path, rx, 0);
9473
+ let startRadian = 0, radian;
9474
+ if (startAngle) {
9475
+ startRadian = startAngle * OneRadian;
9476
+ moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9477
+ } else moveTo$2(path, rx, 0);
9470
9478
  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));
9479
+ radian = i * 2 * PI$1 / sides + startRadian;
9480
+ lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
9472
9481
  }
9473
9482
  closePath$1(path);
9474
9483
  }
@@ -9479,6 +9488,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9479
9488
 
9480
9489
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9481
9490
 
9491
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9492
+
9482
9493
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9483
9494
 
9484
9495
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9494,12 +9505,17 @@ let Star = class Star extends UI {
9494
9505
  return "Star";
9495
9506
  }
9496
9507
  __updatePath() {
9497
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9508
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9498
9509
  const rx = width / 2, ry = height / 2;
9499
9510
  const path = this.__.path = [];
9500
- moveTo$1(path, rx, 0);
9511
+ let startRadian = 0, radian;
9512
+ if (startAngle) {
9513
+ startRadian = startAngle * OneRadian;
9514
+ moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
9515
+ } else moveTo$1(path, rx, 0);
9501
9516
  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));
9517
+ radian = i * PI / corners + startRadian;
9518
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
9503
9519
  }
9504
9520
  closePath(path);
9505
9521
  }
@@ -9511,6 +9527,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9511
9527
 
9512
9528
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9513
9529
 
9530
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9531
+
9514
9532
  Star = __decorate([ registerUI() ], Star);
9515
9533
 
9516
9534
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -9869,7 +9887,8 @@ let Pen = class Pen extends Group {
9869
9887
  return this;
9870
9888
  }
9871
9889
  paint() {
9872
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
9890
+ const {pathElement: pathElement} = this;
9891
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
9873
9892
  }
9874
9893
  };
9875
9894
 
@@ -9953,6 +9972,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
9953
9972
  if (!data.__strokeWidth) return;
9954
9973
  if (data.__font) {
9955
9974
  Paint.strokeText(stroke, ui, canvas, renderOptions);
9975
+ } else if (data.__pathForStroke) {
9976
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
9956
9977
  } else {
9957
9978
  switch (data.strokeAlign) {
9958
9979
  case "center":