@leafer/core 2.1.6 → 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 +27 -26
- package/lib/core.esm.js +27 -26
- package/lib/core.esm.min.js +1 -1
- package/lib/core.esm.min.js.map +1 -1
- package/lib/core.min.cjs +1 -1
- package/lib/core.min.cjs.map +1 -1
- package/package.json +17 -17
- package/src/index.ts +1 -1
- package/types/index.d.ts +1 -1
package/lib/core.cjs
CHANGED
|
@@ -765,15 +765,15 @@ const PointHelper = {
|
|
|
765
765
|
t.x += (t.x - origin.x) * (scaleX - 1);
|
|
766
766
|
t.y += (t.y - origin.y) * (scaleY - 1);
|
|
767
767
|
},
|
|
768
|
-
rotate(t, rotation, origin) {
|
|
768
|
+
rotate(t, rotation, origin, radiusX = 1, radiusY = 1) {
|
|
769
769
|
if (!origin) origin = P$5.defaultPoint;
|
|
770
770
|
rotation *= OneRadian;
|
|
771
771
|
const cosR = cos$2(rotation);
|
|
772
772
|
const sinR = sin$2(rotation);
|
|
773
|
-
const rx = t.x - origin.x;
|
|
774
|
-
const ry = t.y - origin.y;
|
|
775
|
-
t.x = origin.x + rx * cosR - ry * sinR;
|
|
776
|
-
t.y = origin.y + rx * sinR + ry * cosR;
|
|
773
|
+
const rx = (t.x - origin.x) / radiusX;
|
|
774
|
+
const ry = (t.y - origin.y) / radiusY;
|
|
775
|
+
t.x = origin.x + (rx * cosR - ry * sinR) * radiusX;
|
|
776
|
+
t.y = origin.y + (rx * sinR + ry * cosR) * radiusY;
|
|
777
777
|
},
|
|
778
778
|
tempToInnerOf(t, matrix) {
|
|
779
779
|
const {tempPoint: temp} = P$5;
|
|
@@ -833,8 +833,8 @@ const PointHelper = {
|
|
|
833
833
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
834
834
|
return min$1(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
835
835
|
},
|
|
836
|
-
getAngle(t, to) {
|
|
837
|
-
return getAtan2(t, to) / OneRadian;
|
|
836
|
+
getAngle(t, to, radiusX, radiusY) {
|
|
837
|
+
return getAtan2(t, to, radiusX, radiusY) / OneRadian;
|
|
838
838
|
},
|
|
839
839
|
getRotation(t, origin, to, toOrigin) {
|
|
840
840
|
if (!toOrigin) toOrigin = origin;
|
|
@@ -848,8 +848,8 @@ const PointHelper = {
|
|
|
848
848
|
const d = toY - toOriginY;
|
|
849
849
|
return Math.atan2(a * d - b * c, a * c + b * d);
|
|
850
850
|
},
|
|
851
|
-
getAtan2(t, to) {
|
|
852
|
-
return atan2$2(to.y - t.y, to.x - t.x);
|
|
851
|
+
getAtan2(t, to, radiusX = 1, radiusY = 1) {
|
|
852
|
+
return atan2$2((to.y - t.y) / radiusY, (to.x - t.x) / radiusX);
|
|
853
853
|
},
|
|
854
854
|
getDistancePoint(t, to, distance, changeTo, fromTo) {
|
|
855
855
|
const r = getAtan2(t, to);
|
|
@@ -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
|
|
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
|
-
|
|
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.
|
|
6980
|
+
const version = "2.1.8";
|
|
6980
6981
|
|
|
6981
6982
|
exports.AlignHelper = AlignHelper;
|
|
6982
6983
|
|
package/lib/core.esm.js
CHANGED
|
@@ -763,15 +763,15 @@ const PointHelper = {
|
|
|
763
763
|
t.x += (t.x - origin.x) * (scaleX - 1);
|
|
764
764
|
t.y += (t.y - origin.y) * (scaleY - 1);
|
|
765
765
|
},
|
|
766
|
-
rotate(t, rotation, origin) {
|
|
766
|
+
rotate(t, rotation, origin, radiusX = 1, radiusY = 1) {
|
|
767
767
|
if (!origin) origin = P$5.defaultPoint;
|
|
768
768
|
rotation *= OneRadian;
|
|
769
769
|
const cosR = cos$2(rotation);
|
|
770
770
|
const sinR = sin$2(rotation);
|
|
771
|
-
const rx = t.x - origin.x;
|
|
772
|
-
const ry = t.y - origin.y;
|
|
773
|
-
t.x = origin.x + rx * cosR - ry * sinR;
|
|
774
|
-
t.y = origin.y + rx * sinR + ry * cosR;
|
|
771
|
+
const rx = (t.x - origin.x) / radiusX;
|
|
772
|
+
const ry = (t.y - origin.y) / radiusY;
|
|
773
|
+
t.x = origin.x + (rx * cosR - ry * sinR) * radiusX;
|
|
774
|
+
t.y = origin.y + (rx * sinR + ry * cosR) * radiusY;
|
|
775
775
|
},
|
|
776
776
|
tempToInnerOf(t, matrix) {
|
|
777
777
|
const {tempPoint: temp} = P$5;
|
|
@@ -831,8 +831,8 @@ const PointHelper = {
|
|
|
831
831
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
832
832
|
return min$1(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
833
833
|
},
|
|
834
|
-
getAngle(t, to) {
|
|
835
|
-
return getAtan2(t, to) / OneRadian;
|
|
834
|
+
getAngle(t, to, radiusX, radiusY) {
|
|
835
|
+
return getAtan2(t, to, radiusX, radiusY) / OneRadian;
|
|
836
836
|
},
|
|
837
837
|
getRotation(t, origin, to, toOrigin) {
|
|
838
838
|
if (!toOrigin) toOrigin = origin;
|
|
@@ -846,8 +846,8 @@ const PointHelper = {
|
|
|
846
846
|
const d = toY - toOriginY;
|
|
847
847
|
return Math.atan2(a * d - b * c, a * c + b * d);
|
|
848
848
|
},
|
|
849
|
-
getAtan2(t, to) {
|
|
850
|
-
return atan2$2(to.y - t.y, to.x - t.x);
|
|
849
|
+
getAtan2(t, to, radiusX = 1, radiusY = 1) {
|
|
850
|
+
return atan2$2((to.y - t.y) / radiusY, (to.x - t.x) / radiusX);
|
|
851
851
|
},
|
|
852
852
|
getDistancePoint(t, to, distance, changeTo, fromTo) {
|
|
853
853
|
const r = getAtan2(t, to);
|
|
@@ -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
|
|
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
|
-
|
|
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.
|
|
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 };
|