@leafer-draw/worker 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
  class LeaferCanvas extends LeaferCanvasBase {
7085
7085
  get allowBackgroundColor() {
@@ -7885,8 +7885,8 @@ class UIData extends LeafData {
7885
7885
  return this.__getRealStrokeWidth();
7886
7886
  }
7887
7887
  get __maxStrokeWidth() {
7888
- const t = this;
7889
- return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth;
7888
+ const t = this, strokeWidth = t.__hasStrokeSides || t.strokeWidth;
7889
+ return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, strokeWidth) : strokeWidth;
7890
7890
  }
7891
7891
  get __hasMultiPaint() {
7892
7892
  const t = this;
@@ -7987,6 +7987,10 @@ class UIData extends LeafData {
7987
7987
  }
7988
7988
  return strokeWidth;
7989
7989
  }
7990
+ __checkComplex() {
7991
+ const t = this;
7992
+ stintSet$3(t, "__complex", t.__isFills || t.__isStrokes || t.cornerRadius || t.__useEffect);
7993
+ }
7990
7994
  __setPaint(attrName, value) {
7991
7995
  this.__setInput(attrName, value);
7992
7996
  const layout = this.__leaf.__layout;
@@ -8221,7 +8225,7 @@ const UIRender = {
8221
8225
  data.__useEffect = !!(shadow || otherEffect);
8222
8226
  }
8223
8227
  data.__checkSingle();
8224
- stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
8228
+ data.__checkComplex();
8225
8229
  },
8226
8230
  __drawFast(canvas, options) {
8227
8231
  drawFast(this, canvas, options);
@@ -9270,11 +9274,16 @@ let Polygon = class Polygon extends UI {
9270
9274
  if (data.points) {
9271
9275
  drawPoints$1(path, data.points, data.curve, data.closed);
9272
9276
  } else {
9273
- const {width: width, height: height, sides: sides} = data;
9277
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9274
9278
  const rx = width / 2, ry = height / 2;
9275
- moveTo$2(path, rx, 0);
9279
+ let startRadian = 0, radian;
9280
+ if (startAngle) {
9281
+ startRadian = startAngle * OneRadian;
9282
+ moveTo$2(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9283
+ } else moveTo$2(path, rx, 0);
9276
9284
  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));
9285
+ radian = i * 2 * PI$1 / sides + startRadian;
9286
+ lineTo$2(path, rx + rx * sin$1(radian), ry - ry * cos$1(radian));
9278
9287
  }
9279
9288
  closePath$1(path);
9280
9289
  }
@@ -9285,6 +9294,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9285
9294
 
9286
9295
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9287
9296
 
9297
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9298
+
9288
9299
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9289
9300
 
9290
9301
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9300,12 +9311,17 @@ let Star = class Star extends UI {
9300
9311
  return "Star";
9301
9312
  }
9302
9313
  __updatePath() {
9303
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9314
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9304
9315
  const rx = width / 2, ry = height / 2;
9305
9316
  const path = this.__.path = [];
9306
- moveTo$1(path, rx, 0);
9317
+ let startRadian = 0, radian;
9318
+ if (startAngle) {
9319
+ startRadian = startAngle * OneRadian;
9320
+ moveTo$1(path, rx + rx * sin(startRadian), ry - ry * cos(startRadian));
9321
+ } else moveTo$1(path, rx, 0);
9307
9322
  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));
9323
+ radian = i * PI / corners + startRadian;
9324
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(radian));
9309
9325
  }
9310
9326
  closePath(path);
9311
9327
  }
@@ -9317,6 +9333,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9317
9333
 
9318
9334
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9319
9335
 
9336
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9337
+
9320
9338
  Star = __decorate([ registerUI() ], Star);
9321
9339
 
9322
9340
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -9675,7 +9693,8 @@ let Pen = class Pen extends Group {
9675
9693
  return this;
9676
9694
  }
9677
9695
  paint() {
9678
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
9696
+ const {pathElement: pathElement} = this;
9697
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
9679
9698
  }
9680
9699
  };
9681
9700
 
@@ -9759,6 +9778,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
9759
9778
  if (!data.__strokeWidth) return;
9760
9779
  if (data.__font) {
9761
9780
  Paint.strokeText(stroke, ui, canvas, renderOptions);
9781
+ } else if (data.__pathForStroke) {
9782
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
9762
9783
  } else {
9763
9784
  switch (data.strokeAlign) {
9764
9785
  case "center":