@leafer-draw/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$4(endAngle - startAngle) === 360;
2821
+ if (closedAngle) totalRadian = -PI2; else totalRadian -= PI2;
2822
+ }
2820
2823
  const parts = ceil(abs$4(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() {
@@ -8421,9 +8439,6 @@ let UI = UI_1 = class UI extends Leaf {
8421
8439
  get app() {
8422
8440
  return this.leafer && this.leafer.app;
8423
8441
  }
8424
- get isFrame() {
8425
- return false;
8426
- }
8427
8442
  set strokeWidthFixed(value) {
8428
8443
  this.strokeScaleFixed = value;
8429
8444
  }
@@ -9307,34 +9322,28 @@ let Ellipse = class Ellipse extends UI {
9307
9322
  if (hasAngle) closedAngle = abs$2(endAngle - startAngle) === 360;
9308
9323
  if (innerRadius) {
9309
9324
  const drawInnerEllipse = innerRadius < 1 || closed;
9310
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9325
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9311
9326
  if (hasAngle) {
9327
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9312
9328
  if (drawInnerEllipse) {
9313
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9314
9329
  if (closedAngle) {
9315
- set$1(tempPoint, width, ry);
9316
- set$1(tempCenter, rx, ry);
9330
+ closePath$2(path);
9331
+ set$1(tempPoint, rx + innerRx, ry), set$1(tempCenter, rx, ry);
9317
9332
  rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
9318
9333
  moveTo$3(path, tempPoint.x, tempPoint.y);
9319
9334
  }
9320
- outerStartAngle = endAngle;
9321
- outerEndAngle = startAngle;
9322
- outerAnticlockwise = true;
9335
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9323
9336
  } else {
9324
9337
  if (!closedAngle) open = true;
9325
9338
  }
9326
9339
  } else {
9340
+ ellipse(path, rx, ry, rx, ry);
9327
9341
  if (drawInnerEllipse) {
9328
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9329
9342
  closePath$2(path);
9330
- moveTo$3(path, width, ry);
9331
- outerStartAngle = 360;
9332
- outerAnticlockwise = true;
9333
- } else {
9334
- outerEndAngle = 360;
9343
+ moveTo$3(path, rx + innerRx, ry);
9344
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9335
9345
  }
9336
9346
  }
9337
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9338
9347
  } else {
9339
9348
  if (hasAngle) {
9340
9349
  if (!closedAngle) {