@leafer-draw/worker 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() {
@@ -8262,9 +8280,6 @@ let UI = UI_1 = class UI extends Leaf {
8262
8280
  get app() {
8263
8281
  return this.leafer && this.leafer.app;
8264
8282
  }
8265
- get isFrame() {
8266
- return false;
8267
- }
8268
8283
  set strokeWidthFixed(value) {
8269
8284
  this.strokeScaleFixed = value;
8270
8285
  }
@@ -9148,34 +9163,28 @@ let Ellipse = class Ellipse extends UI {
9148
9163
  if (hasAngle) closedAngle = abs$2(endAngle - startAngle) === 360;
9149
9164
  if (innerRadius) {
9150
9165
  const drawInnerEllipse = innerRadius < 1 || closed;
9151
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9166
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9152
9167
  if (hasAngle) {
9168
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9153
9169
  if (drawInnerEllipse) {
9154
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9155
9170
  if (closedAngle) {
9156
- set$1(tempPoint, width, ry);
9157
- set$1(tempCenter, rx, ry);
9171
+ closePath$2(path);
9172
+ set$1(tempPoint, rx + innerRx, ry), set$1(tempCenter, rx, ry);
9158
9173
  rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
9159
9174
  moveTo$3(path, tempPoint.x, tempPoint.y);
9160
9175
  }
9161
- outerStartAngle = endAngle;
9162
- outerEndAngle = startAngle;
9163
- outerAnticlockwise = true;
9176
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9164
9177
  } else {
9165
9178
  if (!closedAngle) open = true;
9166
9179
  }
9167
9180
  } else {
9181
+ ellipse(path, rx, ry, rx, ry);
9168
9182
  if (drawInnerEllipse) {
9169
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9170
9183
  closePath$2(path);
9171
- moveTo$3(path, width, ry);
9172
- outerStartAngle = 360;
9173
- outerAnticlockwise = true;
9174
- } else {
9175
- outerEndAngle = 360;
9184
+ moveTo$3(path, rx + innerRx, ry);
9185
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9176
9186
  }
9177
9187
  }
9178
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9179
9188
  } else {
9180
9189
  if (hasAngle) {
9181
9190
  if (!closedAngle) {