@leafer-draw/worker 2.0.8 → 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.8";
7082
+ const version = "2.0.9";
7083
7083
 
7084
7084
  class LeaferCanvas extends LeaferCanvasBase {
7085
7085
  get allowBackgroundColor() {
@@ -9270,11 +9270,16 @@ let Polygon = class Polygon extends UI {
9270
9270
  if (data.points) {
9271
9271
  drawPoints$1(path, data.points, data.curve, data.closed);
9272
9272
  } else {
9273
- const {width: width, height: height, sides: sides} = data;
9273
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9274
9274
  const rx = width / 2, ry = height / 2;
9275
- moveTo$2(path, rx, 0);
9275
+ let startRadian = 0, radian;
9276
+ if (startAngle) {
9277
+ startRadian = startAngle * OneRadian;
9278
+ moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9279
+ } else moveTo$2(path, rx, 0);
9276
9280
  for (let i = 1; i < sides; i++) {
9277
- lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9281
+ radian = i * 2 * PI$1 / sides + startRadian;
9282
+ lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
9278
9283
  }
9279
9284
  closePath$1(path);
9280
9285
  }
@@ -9285,6 +9290,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9285
9290
 
9286
9291
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9287
9292
 
9293
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9294
+
9288
9295
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9289
9296
 
9290
9297
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9300,12 +9307,17 @@ let Star = class Star extends UI {
9300
9307
  return "Star";
9301
9308
  }
9302
9309
  __updatePath() {
9303
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9310
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9304
9311
  const rx = width / 2, ry = height / 2;
9305
9312
  const path = this.__.path = [];
9306
- moveTo$1(path, rx, 0);
9313
+ let startRadian = 0, radian;
9314
+ if (startAngle) {
9315
+ startRadian = startAngle * OneRadian;
9316
+ moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
9317
+ } else moveTo$1(path, rx, 0);
9307
9318
  for (let i = 1; i < corners * 2; i++) {
9308
- 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));
9319
+ radian = i * PI / corners + startRadian;
9320
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
9309
9321
  }
9310
9322
  closePath(path);
9311
9323
  }
@@ -9317,6 +9329,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9317
9329
 
9318
9330
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9319
9331
 
9332
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9333
+
9320
9334
  Star = __decorate([ registerUI() ], Star);
9321
9335
 
9322
9336
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -9675,7 +9689,8 @@ let Pen = class Pen extends Group {
9675
9689
  return this;
9676
9690
  }
9677
9691
  paint() {
9678
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
9692
+ const {pathElement: pathElement} = this;
9693
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
9679
9694
  }
9680
9695
  };
9681
9696
 
@@ -9759,6 +9774,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
9759
9774
  if (!data.__strokeWidth) return;
9760
9775
  if (data.__font) {
9761
9776
  Paint.strokeText(stroke, ui, canvas, renderOptions);
9777
+ } else if (data.__pathForStroke) {
9778
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
9762
9779
  } else {
9763
9780
  switch (data.strokeAlign) {
9764
9781
  case "center":