leafer-ui 2.1.7 → 2.1.8

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.
package/dist/web.js CHANGED
@@ -904,12 +904,12 @@ var LeaferUI = function(exports) {
904
904
  PointHelper.scaleOf(this, origin, scaleX, scaleY);
905
905
  return this;
906
906
  }
907
- rotate(rotation, origin) {
908
- PointHelper.rotate(this, rotation, origin);
907
+ rotate(rotation, origin, radiusX, radiusY) {
908
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
909
909
  return this;
910
910
  }
911
- rotateOf(origin, rotation) {
912
- PointHelper.rotate(this, rotation, origin);
911
+ rotateOf(origin, rotation, radiusX, radiusY) {
912
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
913
913
  return this;
914
914
  }
915
915
  getRotation(origin, to, toOrigin) {
@@ -932,11 +932,11 @@ var LeaferUI = function(exports) {
932
932
  getDistancePoint(to, distance, changeTo, fromTo) {
933
933
  return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
934
934
  }
935
- getAngle(to) {
936
- return PointHelper.getAngle(this, to);
935
+ getAngle(to, radiusX, radiusY) {
936
+ return PointHelper.getAngle(this, to, radiusX, radiusY);
937
937
  }
938
- getAtan2(to) {
939
- return PointHelper.getAtan2(this, to);
938
+ getAtan2(to, radiusX, radiusY) {
939
+ return PointHelper.getAtan2(this, to, radiusX, radiusY);
940
940
  }
941
941
  isSame(point, quick) {
942
942
  return PointHelper.isSame(this, point, quick);
@@ -4310,7 +4310,9 @@ var LeaferUI = function(exports) {
4310
4310
  set(value) {
4311
4311
  if (this.__setAttr(key, value)) {
4312
4312
  this.waitParent(() => {
4313
- this.parent.__layout.childrenSortChange();
4313
+ const {parent: parent} = this;
4314
+ parent.__layout.childrenSortChange();
4315
+ if (parent.__.flow) parent.__layout.boxChange();
4314
4316
  });
4315
4317
  }
4316
4318
  }
@@ -4691,7 +4693,7 @@ var LeaferUI = function(exports) {
4691
4693
  p = p.parent;
4692
4694
  }
4693
4695
  },
4694
- animateMove(t, move, speed = .3) {
4696
+ animateMove(t, move, speed = .3, onAnimate) {
4695
4697
  if (!move.x && !move.y) return;
4696
4698
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
4697
4699
  t.move(move);
@@ -4699,8 +4701,9 @@ var LeaferUI = function(exports) {
4699
4701
  const x = move.x * speed, y = move.y * speed;
4700
4702
  move.x -= x, move.y -= y;
4701
4703
  t.move(x, y);
4702
- Platform.requestRender(() => L.animateMove(t, move, speed));
4704
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate));
4703
4705
  }
4706
+ onAnimate && onAnimate();
4704
4707
  }
4705
4708
  };
4706
4709
  const L = LeafHelper;
@@ -5774,6 +5777,7 @@ var LeaferUI = function(exports) {
5774
5777
  if (this.isBranch) {
5775
5778
  this.__extraUpdate();
5776
5779
  if (this.__.flow) {
5780
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
5777
5781
  if (this.__layout.boxChanged) this.__updateFlowLayout();
5778
5782
  updateAllMatrix$2(this);
5779
5783
  updateBounds$1(this, this);
@@ -5842,11 +5846,7 @@ var LeaferUI = function(exports) {
5842
5846
  const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize: hasSize} = BoundsHelper;
5843
5847
  const BranchRender = {
5844
5848
  __updateChange() {
5845
- const {__layout: layout} = this;
5846
- if (layout.childrenSortChanged) {
5847
- this.__updateSortChildren();
5848
- layout.childrenSortChanged = false;
5849
- }
5849
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
5850
5850
  this.__.__checkSingle();
5851
5851
  },
5852
5852
  __render(canvas, options) {
@@ -6336,6 +6336,7 @@ var LeaferUI = function(exports) {
6336
6336
  children.sort(sort);
6337
6337
  this.__layout.affectChildrenSort = affectSort;
6338
6338
  }
6339
+ this.__layout.childrenSortChanged = false;
6339
6340
  }
6340
6341
  add(child, index) {
6341
6342
  if (child === this || child.destroyed) return debug$6.warn("add self or destroyed");
@@ -6567,7 +6568,7 @@ var LeaferUI = function(exports) {
6567
6568
  this.levelMap = null;
6568
6569
  }
6569
6570
  }
6570
- const version = "2.1.7";
6571
+ const version = "2.1.8";
6571
6572
  const debug$5 = Debug.get("LeaferCanvas");
6572
6573
  class LeaferCanvas extends LeaferCanvasBase {
6573
6574
  set zIndex(zIndex) {
@@ -8938,7 +8939,10 @@ var LeaferUI = function(exports) {
8938
8939
  ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
8939
8940
  } else {
8940
8941
  if (hasAngle) {
8941
- if (!closedAngle) moveTo$3(path, rx, ry);
8942
+ if (!closedAngle) {
8943
+ if (!closed) open = true;
8944
+ if (!open) moveTo$3(path, rx, ry);
8945
+ }
8942
8946
  ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
8943
8947
  } else {
8944
8948
  ellipse(path, rx, ry, rx, ry);
@@ -9522,8 +9526,8 @@ var LeaferUI = function(exports) {
9522
9526
  if (!change) scale = Object.assign({}, scale);
9523
9527
  tempDragBounds.set(dragBounds);
9524
9528
  tempContent.set(content).scaleOf(origin, scale.x, scale.y);
9525
- const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
9526
- const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
9529
+ const originLeftScale = float((origin.x - content.x) / content.width), originRightScale = float(1 - originLeftScale);
9530
+ const originTopScale = float((origin.y - content.y) / content.height), originBottomScale = float(1 - originTopScale);
9527
9531
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
9528
9532
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
9529
9533
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
@@ -9534,7 +9538,13 @@ var LeaferUI = function(exports) {
9534
9538
  correctScaleX *= max$1(aScale, bScale);
9535
9539
  } else {
9536
9540
  if (scale.x < 0) {
9537
- if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9541
+ if (float(minX(content) - minX(dragBounds), 2) <= 0 || float(maxX(dragBounds) - maxX(content), 2) <= 0) {
9542
+ tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9543
+ if (tempContent.width > 1) {
9544
+ correctScaleX *= 1 / tempContent.width;
9545
+ tempContent.width = 1;
9546
+ }
9547
+ }
9538
9548
  tempContent.unsign();
9539
9549
  }
9540
9550
  aSize = float(tempDragBounds.minX - tempContent.minX);
@@ -9557,7 +9567,13 @@ var LeaferUI = function(exports) {
9557
9567
  }
9558
9568
  } else {
9559
9569
  if (scale.y < 0) {
9560
- if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9570
+ if (float(minY(content) - minY(dragBounds), 2) <= 0 || float(maxY(dragBounds) - maxY(content), 2) <= 0) {
9571
+ tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9572
+ if (tempContent.height > 1) {
9573
+ correctScaleY *= 1 / tempContent.height;
9574
+ tempContent.height = 1;
9575
+ }
9576
+ }
9561
9577
  tempContent.unsign();
9562
9578
  }
9563
9579
  aSize = float(tempDragBounds.minY - tempContent.minY);
@@ -9654,6 +9670,7 @@ var LeaferUI = function(exports) {
9654
9670
  exports.DragEvent.OUT = "drag.out";
9655
9671
  exports.DragEvent.ENTER = "drag.enter";
9656
9672
  exports.DragEvent.LEAVE = "drag.leave";
9673
+ exports.DragEvent.ANIMATE = "drag.animate";
9657
9674
  exports.DragEvent = __decorate([ registerUIEvent() ], exports.DragEvent);
9658
9675
  const MyDragEvent = exports.DragEvent;
9659
9676
  exports.DropEvent = class DropEvent extends exports.PointerEvent {
@@ -9861,7 +9878,7 @@ var LeaferUI = function(exports) {
9861
9878
  x: totalX,
9862
9879
  y: totalY
9863
9880
  }, checkLimitMove || axisDrag);
9864
- if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
9881
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3, () => leaf.emit(exports.DragEvent.ANIMATE)); else leaf.move(move);
9865
9882
  }
9866
9883
  });
9867
9884
  }