@leafer-draw/miniapp 2.1.7 → 2.1.9

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.
@@ -913,12 +913,12 @@ class Point {
913
913
  PointHelper.scaleOf(this, origin, scaleX, scaleY);
914
914
  return this;
915
915
  }
916
- rotate(rotation, origin) {
917
- PointHelper.rotate(this, rotation, origin);
916
+ rotate(rotation, origin, radiusX, radiusY) {
917
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
918
918
  return this;
919
919
  }
920
- rotateOf(origin, rotation) {
921
- PointHelper.rotate(this, rotation, origin);
920
+ rotateOf(origin, rotation, radiusX, radiusY) {
921
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
922
922
  return this;
923
923
  }
924
924
  getRotation(origin, to, toOrigin) {
@@ -941,11 +941,11 @@ class Point {
941
941
  getDistancePoint(to, distance, changeTo, fromTo) {
942
942
  return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
943
943
  }
944
- getAngle(to) {
945
- return PointHelper.getAngle(this, to);
944
+ getAngle(to, radiusX, radiusY) {
945
+ return PointHelper.getAngle(this, to, radiusX, radiusY);
946
946
  }
947
- getAtan2(to) {
948
- return PointHelper.getAtan2(this, to);
947
+ getAtan2(to, radiusX, radiusY) {
948
+ return PointHelper.getAtan2(this, to, radiusX, radiusY);
949
949
  }
950
950
  isSame(point, quick) {
951
951
  return PointHelper.isSame(this, point, quick);
@@ -4586,7 +4586,9 @@ function sortType(defaultValue) {
4586
4586
  set(value) {
4587
4587
  if (this.__setAttr(key, value)) {
4588
4588
  this.waitParent(() => {
4589
- this.parent.__layout.childrenSortChange();
4589
+ const {parent: parent} = this;
4590
+ parent.__layout.childrenSortChange();
4591
+ if (parent.__.flow) parent.__layout.boxChange();
4590
4592
  });
4591
4593
  }
4592
4594
  }
@@ -4988,7 +4990,7 @@ const LeafHelper = {
4988
4990
  p = p.parent;
4989
4991
  }
4990
4992
  },
4991
- animateMove(t, move, speed = .3) {
4993
+ animateMove(t, move, speed = .3, onAnimate) {
4992
4994
  if (!move.x && !move.y) return;
4993
4995
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
4994
4996
  t.move(move);
@@ -4996,8 +4998,9 @@ const LeafHelper = {
4996
4998
  const x = move.x * speed, y = move.y * speed;
4997
4999
  move.x -= x, move.y -= y;
4998
5000
  t.move(x, y);
4999
- Platform.requestRender(() => L.animateMove(t, move, speed));
5001
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate));
5000
5002
  }
5003
+ onAnimate && onAnimate();
5001
5004
  }
5002
5005
  };
5003
5006
 
@@ -6169,6 +6172,7 @@ const LeafBounds = {
6169
6172
  if (this.isBranch) {
6170
6173
  this.__extraUpdate();
6171
6174
  if (this.__.flow) {
6175
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6172
6176
  if (this.__layout.boxChanged) this.__updateFlowLayout();
6173
6177
  updateAllMatrix$2(this);
6174
6178
  updateBounds$1(this, this);
@@ -6240,11 +6244,7 @@ const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize:
6240
6244
 
6241
6245
  const BranchRender = {
6242
6246
  __updateChange() {
6243
- const {__layout: layout} = this;
6244
- if (layout.childrenSortChanged) {
6245
- this.__updateSortChildren();
6246
- layout.childrenSortChanged = false;
6247
- }
6247
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6248
6248
  this.__.__checkSingle();
6249
6249
  },
6250
6250
  __render(canvas, options) {
@@ -6748,6 +6748,7 @@ let Branch = class Branch extends Leaf {
6748
6748
  children.sort(sort);
6749
6749
  this.__layout.affectChildrenSort = affectSort;
6750
6750
  }
6751
+ this.__layout.childrenSortChanged = false;
6751
6752
  }
6752
6753
  add(child, index) {
6753
6754
  if (child === this || child.destroyed) return debug$4.warn("add self or destroyed");
@@ -6983,7 +6984,7 @@ class LeafLevelList {
6983
6984
  }
6984
6985
  }
6985
6986
 
6986
- const version = "2.1.7";
6987
+ const version = "2.1.9";
6987
6988
 
6988
6989
  class LeaferCanvas extends LeaferCanvasBase {
6989
6990
  get allowBackgroundColor() {
@@ -7299,7 +7300,10 @@ class Watcher {
7299
7300
  if (this.running) this.target.emit(RenderEvent.REQUEST);
7300
7301
  }
7301
7302
  __onAttrChange(event) {
7302
- if (this.config.usePartLayout) this.__updatedList.add(event.target);
7303
+ this.add(event.target);
7304
+ }
7305
+ add(leaf) {
7306
+ if (this.config.usePartLayout) this.__updatedList.add(leaf);
7303
7307
  this.update();
7304
7308
  }
7305
7309
  __onChildEvent(event) {
@@ -8138,11 +8142,7 @@ class PolygonData extends UIData {
8138
8142
  }
8139
8143
  }
8140
8144
 
8141
- class StarData extends UIData {
8142
- get __boxStroke() {
8143
- return !this.__pathInputed;
8144
- }
8145
- }
8145
+ class StarData extends UIData {}
8146
8146
 
8147
8147
  class PathData extends UIData {
8148
8148
  get __pathInputed() {
@@ -9313,7 +9313,10 @@ let Ellipse = class Ellipse extends UI {
9313
9313
  ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9314
9314
  } else {
9315
9315
  if (hasAngle) {
9316
- if (!closedAngle) moveTo$3(path, rx, ry);
9316
+ if (!closedAngle) {
9317
+ if (!closed) open = true;
9318
+ if (!open) moveTo$3(path, rx, ry);
9319
+ }
9317
9320
  ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9318
9321
  } else {
9319
9322
  ellipse(path, rx, ry, rx, ry);
@@ -10432,13 +10435,9 @@ function createPattern(paint, ui, canvas, renderOptions) {
10432
10435
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
10433
10436
  width *= scaleX;
10434
10437
  height *= scaleY;
10435
- if (gap) {
10438
+ if (gap && !brush) {
10436
10439
  xGap = gap.x * scaleX / abs$1(data.scaleX || 1);
10437
10440
  yGap = gap.y * scaleY / abs$1(data.scaleY || 1);
10438
- if (brush) {
10439
- const brushScale = PaintImage.getBrushScale(paint, ui);
10440
- xGap /= brushScale, yGap /= brushScale;
10441
- }
10442
10441
  }
10443
10442
  if (transform || scaleX !== 1 || scaleY !== 1) {
10444
10443
  scaleX *= getFloorScale(width + (xGap || 0));