@leafer/core 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/lib/core.cjs CHANGED
@@ -906,12 +906,12 @@ class Point {
906
906
  PointHelper.scaleOf(this, origin, scaleX, scaleY);
907
907
  return this;
908
908
  }
909
- rotate(rotation, origin) {
910
- PointHelper.rotate(this, rotation, origin);
909
+ rotate(rotation, origin, radiusX, radiusY) {
910
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
911
911
  return this;
912
912
  }
913
- rotateOf(origin, rotation) {
914
- PointHelper.rotate(this, rotation, origin);
913
+ rotateOf(origin, rotation, radiusX, radiusY) {
914
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
915
915
  return this;
916
916
  }
917
917
  getRotation(origin, to, toOrigin) {
@@ -934,11 +934,11 @@ class Point {
934
934
  getDistancePoint(to, distance, changeTo, fromTo) {
935
935
  return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
936
936
  }
937
- getAngle(to) {
938
- return PointHelper.getAngle(this, to);
937
+ getAngle(to, radiusX, radiusY) {
938
+ return PointHelper.getAngle(this, to, radiusX, radiusY);
939
939
  }
940
- getAtan2(to) {
941
- return PointHelper.getAtan2(this, to);
940
+ getAtan2(to, radiusX, radiusY) {
941
+ return PointHelper.getAtan2(this, to, radiusX, radiusY);
942
942
  }
943
943
  isSame(point, quick) {
944
944
  return PointHelper.isSame(this, point, quick);
@@ -4579,7 +4579,9 @@ function sortType(defaultValue) {
4579
4579
  set(value) {
4580
4580
  if (this.__setAttr(key, value)) {
4581
4581
  this.waitParent(() => {
4582
- this.parent.__layout.childrenSortChange();
4582
+ const {parent: parent} = this;
4583
+ parent.__layout.childrenSortChange();
4584
+ if (parent.__.flow) parent.__layout.boxChange();
4583
4585
  });
4584
4586
  }
4585
4587
  }
@@ -4981,7 +4983,7 @@ const LeafHelper = {
4981
4983
  p = p.parent;
4982
4984
  }
4983
4985
  },
4984
- animateMove(t, move, speed = .3) {
4986
+ animateMove(t, move, speed = .3, onAnimate) {
4985
4987
  if (!move.x && !move.y) return;
4986
4988
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
4987
4989
  t.move(move);
@@ -4989,8 +4991,9 @@ const LeafHelper = {
4989
4991
  const x = move.x * speed, y = move.y * speed;
4990
4992
  move.x -= x, move.y -= y;
4991
4993
  t.move(x, y);
4992
- Platform.requestRender(() => L.animateMove(t, move, speed));
4994
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate));
4993
4995
  }
4996
+ onAnimate && onAnimate();
4994
4997
  }
4995
4998
  };
4996
4999
 
@@ -6162,6 +6165,7 @@ const LeafBounds = {
6162
6165
  if (this.isBranch) {
6163
6166
  this.__extraUpdate();
6164
6167
  if (this.__.flow) {
6168
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6165
6169
  if (this.__layout.boxChanged) this.__updateFlowLayout();
6166
6170
  updateAllMatrix(this);
6167
6171
  updateBounds(this, this);
@@ -6233,11 +6237,7 @@ const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper, {hasSize: h
6233
6237
 
6234
6238
  const BranchRender = {
6235
6239
  __updateChange() {
6236
- const {__layout: layout} = this;
6237
- if (layout.childrenSortChanged) {
6238
- this.__updateSortChildren();
6239
- layout.childrenSortChanged = false;
6240
- }
6240
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6241
6241
  this.__.__checkSingle();
6242
6242
  },
6243
6243
  __render(canvas, options) {
@@ -6741,6 +6741,7 @@ exports.Branch = class Branch extends exports.Leaf {
6741
6741
  children.sort(sort);
6742
6742
  this.__layout.affectChildrenSort = affectSort;
6743
6743
  }
6744
+ this.__layout.childrenSortChanged = false;
6744
6745
  }
6745
6746
  add(child, index) {
6746
6747
  if (child === this || child.destroyed) return debug.warn("add self or destroyed");
@@ -6976,7 +6977,7 @@ class LeafLevelList {
6976
6977
  }
6977
6978
  }
6978
6979
 
6979
- const version = "2.1.7";
6980
+ const version = "2.1.8";
6980
6981
 
6981
6982
  exports.AlignHelper = AlignHelper;
6982
6983
 
package/lib/core.esm.js CHANGED
@@ -904,12 +904,12 @@ class Point {
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 @@ class Point {
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);
@@ -4577,7 +4577,9 @@ function sortType(defaultValue) {
4577
4577
  set(value) {
4578
4578
  if (this.__setAttr(key, value)) {
4579
4579
  this.waitParent(() => {
4580
- this.parent.__layout.childrenSortChange();
4580
+ const {parent: parent} = this;
4581
+ parent.__layout.childrenSortChange();
4582
+ if (parent.__.flow) parent.__layout.boxChange();
4581
4583
  });
4582
4584
  }
4583
4585
  }
@@ -4979,7 +4981,7 @@ const LeafHelper = {
4979
4981
  p = p.parent;
4980
4982
  }
4981
4983
  },
4982
- animateMove(t, move, speed = .3) {
4984
+ animateMove(t, move, speed = .3, onAnimate) {
4983
4985
  if (!move.x && !move.y) return;
4984
4986
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
4985
4987
  t.move(move);
@@ -4987,8 +4989,9 @@ const LeafHelper = {
4987
4989
  const x = move.x * speed, y = move.y * speed;
4988
4990
  move.x -= x, move.y -= y;
4989
4991
  t.move(x, y);
4990
- Platform.requestRender(() => L.animateMove(t, move, speed));
4992
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate));
4991
4993
  }
4994
+ onAnimate && onAnimate();
4992
4995
  }
4993
4996
  };
4994
4997
 
@@ -6160,6 +6163,7 @@ const LeafBounds = {
6160
6163
  if (this.isBranch) {
6161
6164
  this.__extraUpdate();
6162
6165
  if (this.__.flow) {
6166
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6163
6167
  if (this.__layout.boxChanged) this.__updateFlowLayout();
6164
6168
  updateAllMatrix(this);
6165
6169
  updateBounds(this, this);
@@ -6231,11 +6235,7 @@ const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper, {hasSize: h
6231
6235
 
6232
6236
  const BranchRender = {
6233
6237
  __updateChange() {
6234
- const {__layout: layout} = this;
6235
- if (layout.childrenSortChanged) {
6236
- this.__updateSortChildren();
6237
- layout.childrenSortChanged = false;
6238
- }
6238
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6239
6239
  this.__.__checkSingle();
6240
6240
  },
6241
6241
  __render(canvas, options) {
@@ -6739,6 +6739,7 @@ let Branch = class Branch extends Leaf {
6739
6739
  children.sort(sort);
6740
6740
  this.__layout.affectChildrenSort = affectSort;
6741
6741
  }
6742
+ this.__layout.childrenSortChanged = false;
6742
6743
  }
6743
6744
  add(child, index) {
6744
6745
  if (child === this || child.destroyed) return debug.warn("add self or destroyed");
@@ -6974,6 +6975,6 @@ class LeafLevelList {
6974
6975
  }
6975
6976
  }
6976
6977
 
6977
- const version = "2.1.7";
6978
+ const version = "2.1.8";
6978
6979
 
6979
6980
  export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, FourNumberHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, UnitConvertHelper, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };