@leafer-ui/miniapp 2.2.2 → 2.2.4

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.
@@ -2816,7 +2816,10 @@ const BezierHelper = {
2816
2816
  if (endRadian < 0) endRadian += PI2;
2817
2817
  let totalRadian = endRadian - startRadian;
2818
2818
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2819
- if (anticlockwise) totalRadian -= PI2;
2819
+ if (anticlockwise) {
2820
+ const closedAngle = abs$5(endAngle - startAngle) === 360;
2821
+ if (closedAngle) totalRadian = -PI2; else totalRadian -= PI2;
2822
+ }
2820
2823
  const parts = ceil(abs$5(totalRadian / PI_2));
2821
2824
  const partRadian = totalRadian / parts;
2822
2825
  const partRadian4Sin = sin$3(partRadian / 4);
@@ -4168,7 +4171,7 @@ const ImageManager = {
4168
4171
  patternTasker: Resource.queue,
4169
4172
  get(config, type) {
4170
4173
  let image = Resource.get(config.url);
4171
- if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
4174
+ if (!image) Resource.set(config.url, image = Creator[type || "image"](config));
4172
4175
  image.use++;
4173
4176
  return image;
4174
4177
  },
@@ -6340,6 +6343,9 @@ let Leaf = class Leaf {
6340
6343
  get isLeafer() {
6341
6344
  return false;
6342
6345
  }
6346
+ get isFrame() {
6347
+ return false;
6348
+ }
6343
6349
  get isBranch() {
6344
6350
  return false;
6345
6351
  }
@@ -6481,6 +6487,16 @@ let Leaf = class Leaf {
6481
6487
  }
6482
6488
  }
6483
6489
  }
6490
+ __bindFrame(frame) {
6491
+ if (this.isFrame && frame !== null) frame = this;
6492
+ this.frame = frame;
6493
+ if (this.isBranch) {
6494
+ const {children: children} = this;
6495
+ for (let i = 0, len = children.length; i < len; i++) {
6496
+ children[i].__bindFrame(frame);
6497
+ }
6498
+ }
6499
+ }
6484
6500
  setAttr(name, value) {
6485
6501
  this[name] = value;
6486
6502
  }
@@ -6789,6 +6805,7 @@ let Branch = class Branch extends Leaf {
6789
6805
  childLayout.boxChanged || childLayout.boxChange();
6790
6806
  childLayout.matrixChanged || childLayout.matrixChange();
6791
6807
  if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
6808
+ if (this.isFrame) child.__bindFrame(this);
6792
6809
  if (this.leafer) {
6793
6810
  child.__bindLeafer(this.leafer);
6794
6811
  if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
@@ -6848,6 +6865,7 @@ let Branch = class Branch extends Leaf {
6848
6865
  if (this.leafer.hitCanvasManager) this.leafer.hitCanvasManager.clear();
6849
6866
  }
6850
6867
  }
6868
+ if (this.isFrame) child.__bindFrame(null);
6851
6869
  }
6852
6870
  __emitChildEvent(type, child) {
6853
6871
  const event = new ChildEvent(type, child, this);
@@ -7005,7 +7023,7 @@ class LeafLevelList {
7005
7023
  }
7006
7024
  }
7007
7025
 
7008
- const version = "2.2.1";
7026
+ const version = "2.2.4";
7009
7027
 
7010
7028
  class LeaferCanvas extends LeaferCanvasBase {
7011
7029
  get allowBackgroundColor() {
@@ -8617,9 +8635,6 @@ let UI = UI_1 = class UI extends Leaf {
8617
8635
  get app() {
8618
8636
  return this.leafer && this.leafer.app;
8619
8637
  }
8620
- get isFrame() {
8621
- return false;
8622
- }
8623
8638
  set strokeWidthFixed(value) {
8624
8639
  this.strokeScaleFixed = value;
8625
8640
  }
@@ -9503,34 +9518,28 @@ let Ellipse = class Ellipse extends UI {
9503
9518
  if (hasAngle) closedAngle = abs$3(endAngle - startAngle) === 360;
9504
9519
  if (innerRadius) {
9505
9520
  const drawInnerEllipse = innerRadius < 1 || closed;
9506
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9521
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9507
9522
  if (hasAngle) {
9523
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9508
9524
  if (drawInnerEllipse) {
9509
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9510
9525
  if (closedAngle) {
9511
- set$1(tempPoint, width, ry);
9512
- set$1(tempCenter, rx, ry);
9526
+ closePath$2(path);
9527
+ set$1(tempPoint, rx + innerRx, ry), set$1(tempCenter, rx, ry);
9513
9528
  rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
9514
9529
  moveTo$3(path, tempPoint.x, tempPoint.y);
9515
9530
  }
9516
- outerStartAngle = endAngle;
9517
- outerEndAngle = startAngle;
9518
- outerAnticlockwise = true;
9531
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9519
9532
  } else {
9520
9533
  if (!closedAngle) open = true;
9521
9534
  }
9522
9535
  } else {
9536
+ ellipse(path, rx, ry, rx, ry);
9523
9537
  if (drawInnerEllipse) {
9524
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9525
9538
  closePath$2(path);
9526
- moveTo$3(path, width, ry);
9527
- outerStartAngle = 360;
9528
- outerAnticlockwise = true;
9529
- } else {
9530
- outerEndAngle = 360;
9539
+ moveTo$3(path, rx + innerRx, ry);
9540
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9531
9541
  }
9532
9542
  }
9533
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9534
9543
  } else {
9535
9544
  if (hasAngle) {
9536
9545
  if (!closedAngle) {
@@ -11430,7 +11439,8 @@ ui$1.__hit = function(inner, forceHitFill) {
11430
11439
  const {hitFill: hitFill} = data;
11431
11440
  const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
11432
11441
  if (needHitFillPath && this.__hitFill(inner)) return true;
11433
- const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
11442
+ const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
11443
+ const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
11434
11444
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
11435
11445
  if (!needHitFillPath && !needHitStrokePath) return false;
11436
11446
  const radiusWidth = inner.radiusX * 2;