leafer-ui 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
  const debug$5 = Debug.get("LeaferCanvas");
7011
7029
 
@@ -8652,9 +8670,6 @@ let UI = UI_1 = class UI extends Leaf {
8652
8670
  get app() {
8653
8671
  return this.leafer && this.leafer.app;
8654
8672
  }
8655
- get isFrame() {
8656
- return false;
8657
- }
8658
8673
  set strokeWidthFixed(value) {
8659
8674
  this.strokeScaleFixed = value;
8660
8675
  }
@@ -9538,34 +9553,28 @@ let Ellipse = class Ellipse extends UI {
9538
9553
  if (hasAngle) closedAngle = abs$3(endAngle - startAngle) === 360;
9539
9554
  if (innerRadius) {
9540
9555
  const drawInnerEllipse = innerRadius < 1 || closed;
9541
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9556
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9542
9557
  if (hasAngle) {
9558
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9543
9559
  if (drawInnerEllipse) {
9544
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9545
9560
  if (closedAngle) {
9546
- set$1(tempPoint, width, ry);
9547
- set$1(tempCenter, rx, ry);
9561
+ closePath$2(path);
9562
+ set$1(tempPoint, rx + innerRx, ry), set$1(tempCenter, rx, ry);
9548
9563
  rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
9549
9564
  moveTo$3(path, tempPoint.x, tempPoint.y);
9550
9565
  }
9551
- outerStartAngle = endAngle;
9552
- outerEndAngle = startAngle;
9553
- outerAnticlockwise = true;
9566
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9554
9567
  } else {
9555
9568
  if (!closedAngle) open = true;
9556
9569
  }
9557
9570
  } else {
9571
+ ellipse(path, rx, ry, rx, ry);
9558
9572
  if (drawInnerEllipse) {
9559
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9560
9573
  closePath$2(path);
9561
- moveTo$3(path, width, ry);
9562
- outerStartAngle = 360;
9563
- outerAnticlockwise = true;
9564
- } else {
9565
- outerEndAngle = 360;
9574
+ moveTo$3(path, rx + innerRx, ry);
9575
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9566
9576
  }
9567
9577
  }
9568
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9569
9578
  } else {
9570
9579
  if (hasAngle) {
9571
9580
  if (!closedAngle) {
@@ -11465,7 +11474,8 @@ ui$1.__hit = function(inner, forceHitFill) {
11465
11474
  const {hitFill: hitFill} = data;
11466
11475
  const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
11467
11476
  if (needHitFillPath && this.__hitFill(inner)) return true;
11468
- const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
11477
+ const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
11478
+ const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
11469
11479
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
11470
11480
  if (!needHitFillPath && !needHitStrokePath) return false;
11471
11481
  const radiusWidth = inner.radiusX * 2;