leafer-ui 2.2.3 → 2.2.5

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);
@@ -4770,7 +4773,7 @@ function useModule(module, exclude) {
4770
4773
  if (!excludeNames.includes(name) && (!exclude || !exclude.includes(name))) {
4771
4774
  if (module.prototype) {
4772
4775
  const d = getDescriptor(module.prototype, name);
4773
- if (d.writable) target.prototype[name] = module.prototype[name];
4776
+ if (d) Object.defineProperty(target.prototype, name, d);
4774
4777
  } else {
4775
4778
  target.prototype[name] = module[name];
4776
4779
  }
@@ -6802,11 +6805,11 @@ let Branch = class Branch extends Leaf {
6802
6805
  childLayout.boxChanged || childLayout.boxChange();
6803
6806
  childLayout.matrixChanged || childLayout.matrixChange();
6804
6807
  if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
6808
+ if (this.isFrame) child.__bindFrame(this);
6805
6809
  if (this.leafer) {
6806
6810
  child.__bindLeafer(this.leafer);
6807
6811
  if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
6808
6812
  }
6809
- if (this.isFrame) child.__bindFrame(this);
6810
6813
  this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
6811
6814
  }
6812
6815
  addMany(...children) {
@@ -7020,7 +7023,7 @@ class LeafLevelList {
7020
7023
  }
7021
7024
  }
7022
7025
 
7023
- const version = "2.2.3";
7026
+ const version = "2.2.5";
7024
7027
 
7025
7028
  const debug$5 = Debug.get("LeaferCanvas");
7026
7029
 
@@ -8027,7 +8030,7 @@ class Picker {
8027
8030
  if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
8028
8031
  const {parent: parent, mask: mask} = child;
8029
8032
  if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
8030
- if (!parent.children.some(item => !item.mask && item.__hitWorld(point))) return;
8033
+ if (!parent.children.some(item => !item.mask && this.isHitLeaf(item, point))) return;
8031
8034
  }
8032
8035
  const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
8033
8036
  if (hitThrough) {
@@ -8037,6 +8040,15 @@ class Picker {
8037
8040
  findList.add(leaf);
8038
8041
  }
8039
8042
  }
8043
+ isHitLeaf(leaf, point) {
8044
+ if (leaf.isBranch) {
8045
+ const {findList: findList} = this, old = findList.length;
8046
+ this.eachFind([ leaf ], false);
8047
+ const count = findList.length - old;
8048
+ for (let i = 0; i < count; i++) findList.remove(findList.indexAt(findList.length - 1));
8049
+ return !!count;
8050
+ } else return leaf.__hitWorld(point);
8051
+ }
8040
8052
  clear() {
8041
8053
  this.point = null;
8042
8054
  this.findList = null;
@@ -9550,34 +9562,28 @@ let Ellipse = class Ellipse extends UI {
9550
9562
  if (hasAngle) closedAngle = abs$3(endAngle - startAngle) === 360;
9551
9563
  if (innerRadius) {
9552
9564
  const drawInnerEllipse = innerRadius < 1 || closed;
9553
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9565
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9554
9566
  if (hasAngle) {
9567
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9555
9568
  if (drawInnerEllipse) {
9556
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9557
9569
  if (closedAngle) {
9558
- set$1(tempPoint, width, ry);
9559
- set$1(tempCenter, rx, ry);
9570
+ closePath$2(path);
9571
+ set$1(tempPoint, rx + innerRx, ry), set$1(tempCenter, rx, ry);
9560
9572
  rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
9561
9573
  moveTo$3(path, tempPoint.x, tempPoint.y);
9562
9574
  }
9563
- outerStartAngle = endAngle;
9564
- outerEndAngle = startAngle;
9565
- outerAnticlockwise = true;
9575
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9566
9576
  } else {
9567
9577
  if (!closedAngle) open = true;
9568
9578
  }
9569
9579
  } else {
9580
+ ellipse(path, rx, ry, rx, ry);
9570
9581
  if (drawInnerEllipse) {
9571
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9572
9582
  closePath$2(path);
9573
- moveTo$3(path, width, ry);
9574
- outerStartAngle = 360;
9575
- outerAnticlockwise = true;
9576
- } else {
9577
- outerEndAngle = 360;
9583
+ moveTo$3(path, rx + innerRx, ry);
9584
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9578
9585
  }
9579
9586
  }
9580
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9581
9587
  } else {
9582
9588
  if (hasAngle) {
9583
9589
  if (!closedAngle) {
@@ -11477,7 +11483,8 @@ ui$1.__hit = function(inner, forceHitFill) {
11477
11483
  const {hitFill: hitFill} = data;
11478
11484
  const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
11479
11485
  if (needHitFillPath && this.__hitFill(inner)) return true;
11480
- const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
11486
+ const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
11487
+ const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
11481
11488
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
11482
11489
  if (!needHitFillPath && !needHitStrokePath) return false;
11483
11490
  const radiusWidth = inner.radiusX * 2;