@leafer/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() {
@@ -9470,11 +9470,16 @@ let Polygon = class Polygon extends UI {
9470
9470
  if (data.points) {
9471
9471
  drawPoints$1(path, data.points, data.curve, data.closed);
9472
9472
  } else {
9473
- const {width: width, height: height, sides: sides} = data;
9473
+ const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
9474
9474
  const rx = width / 2, ry = height / 2;
9475
- moveTo$2(path, rx, 0);
9475
+ let startRadian = 0, radian;
9476
+ if (startAngle) {
9477
+ startRadian = startAngle * OneRadian;
9478
+ moveTo$2(path, rx + rx * sin$2(startRadian), ry - ry * cos$2(startRadian));
9479
+ } else moveTo$2(path, rx, 0);
9476
9480
  for (let i = 1; i < sides; i++) {
9477
- lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9481
+ radian = i * 2 * PI$2 / sides + startRadian;
9482
+ lineTo$2(path, rx + rx * sin$2(radian), ry - ry * cos$2(radian));
9478
9483
  }
9479
9484
  closePath$1(path);
9480
9485
  }
@@ -9485,6 +9490,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
9485
9490
 
9486
9491
  __decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
9487
9492
 
9493
+ __decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
9494
+
9488
9495
  __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9489
9496
 
9490
9497
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
@@ -9500,12 +9507,17 @@ let Star = class Star extends UI {
9500
9507
  return "Star";
9501
9508
  }
9502
9509
  __updatePath() {
9503
- const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9510
+ const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
9504
9511
  const rx = width / 2, ry = height / 2;
9505
9512
  const path = this.__.path = [];
9506
- moveTo$1(path, rx, 0);
9513
+ let startRadian = 0, radian;
9514
+ if (startAngle) {
9515
+ startRadian = startAngle * OneRadian;
9516
+ moveTo$1(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
9517
+ } else moveTo$1(path, rx, 0);
9507
9518
  for (let i = 1; i < corners * 2; i++) {
9508
- lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
9519
+ radian = i * PI$1 / corners + startRadian;
9520
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(radian));
9509
9521
  }
9510
9522
  closePath(path);
9511
9523
  }
@@ -9517,6 +9529,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
9517
9529
 
9518
9530
  __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9519
9531
 
9532
+ __decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
9533
+
9520
9534
  Star = __decorate([ registerUI() ], Star);
9521
9535
 
9522
9536
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
@@ -9875,7 +9889,8 @@ let Pen = class Pen extends Group {
9875
9889
  return this;
9876
9890
  }
9877
9891
  paint() {
9878
- if (!this.pathElement.__layout.boxChanged) this.pathElement.forceUpdate("path");
9892
+ const {pathElement: pathElement} = this;
9893
+ if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
9879
9894
  }
9880
9895
  };
9881
9896
 
@@ -10117,7 +10132,7 @@ const DragBoundsHelper = {
10117
10132
  return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
10118
10133
  },
10119
10134
  isInnerMode(content, dragBounds, dragBoundsType, sideType) {
10120
- return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
10135
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && float$3(content[sideType]) > float$3(dragBounds[sideType]);
10121
10136
  },
10122
10137
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
10123
10138
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
@@ -11475,6 +11490,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
11475
11490
  if (!data.__strokeWidth) return;
11476
11491
  if (data.__font) {
11477
11492
  Paint.strokeText(stroke, ui, canvas, renderOptions);
11493
+ } else if (data.__pathForStroke) {
11494
+ Paint.fillStroke(stroke, ui, canvas, renderOptions);
11478
11495
  } else {
11479
11496
  switch (data.strokeAlign) {
11480
11497
  case "center":
@@ -15725,10 +15742,22 @@ function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
15725
15742
  }
15726
15743
  }
15727
15744
  leaf.fontSize *= fontScale;
15728
- const data = leaf.__, {padding: padding} = data;
15745
+ const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
15729
15746
  if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
15730
15747
  if (!data.__autoWidth) leaf.width *= fontScale;
15731
15748
  if (!data.__autoHeight) leaf.height *= fontScale;
15749
+ if (isObject(lineHeight)) {
15750
+ if (lineHeight.type === "px") data.lineHeight = {
15751
+ type: "px",
15752
+ value: lineHeight.value * fontScale
15753
+ };
15754
+ } else if (lineHeight) data.lineHeight = lineHeight * fontScale;
15755
+ if (isObject(letterSpacing)) {
15756
+ if (letterSpacing.type === "px") data.letterSpacing = {
15757
+ type: "px",
15758
+ value: letterSpacing.value * fontScale
15759
+ };
15760
+ } else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
15732
15761
  }
15733
15762
 
15734
15763
  function scaleResizePath(leaf, scaleX, scaleY) {