@leafer/core 1.10.1 → 1.11.0
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 +47 -25
- package/lib/core.esm.js +46 -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
|
@@ -874,9 +874,10 @@ const PointHelper = {
|
|
|
874
874
|
getAtan2(t, to) {
|
|
875
875
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
876
876
|
},
|
|
877
|
-
getDistancePoint(t, to, distance, changeTo) {
|
|
877
|
+
getDistancePoint(t, to, distance, changeTo, fromTo) {
|
|
878
878
|
const r = getAtan2(t, to);
|
|
879
|
-
|
|
879
|
+
fromTo && (t = to);
|
|
880
|
+
changeTo || (to = {});
|
|
880
881
|
to.x = t.x + cos$2(r) * distance;
|
|
881
882
|
to.y = t.y + sin$2(r) * distance;
|
|
882
883
|
return to;
|
|
@@ -886,6 +887,9 @@ const PointHelper = {
|
|
|
886
887
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
887
888
|
return points;
|
|
888
889
|
},
|
|
890
|
+
isSame(t, point) {
|
|
891
|
+
return t.x === point.x && t.y === point.y;
|
|
892
|
+
},
|
|
889
893
|
reset(t) {
|
|
890
894
|
P$5.reset(t);
|
|
891
895
|
}
|
|
@@ -950,8 +954,8 @@ class Point {
|
|
|
950
954
|
getDistance(to) {
|
|
951
955
|
return PointHelper.getDistance(this, to);
|
|
952
956
|
}
|
|
953
|
-
getDistancePoint(to, distance, changeTo) {
|
|
954
|
-
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo));
|
|
957
|
+
getDistancePoint(to, distance, changeTo, fromTo) {
|
|
958
|
+
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
|
|
955
959
|
}
|
|
956
960
|
getAngle(to) {
|
|
957
961
|
return PointHelper.getAngle(this, to);
|
|
@@ -959,6 +963,9 @@ class Point {
|
|
|
959
963
|
getAtan2(to) {
|
|
960
964
|
return PointHelper.getAtan2(this, to);
|
|
961
965
|
}
|
|
966
|
+
isSame(point) {
|
|
967
|
+
return PointHelper.isSame(this, point);
|
|
968
|
+
}
|
|
962
969
|
reset() {
|
|
963
970
|
PointHelper.reset(this);
|
|
964
971
|
return this;
|
|
@@ -2878,6 +2885,15 @@ const EllipseHelper = {
|
|
|
2878
2885
|
}
|
|
2879
2886
|
};
|
|
2880
2887
|
|
|
2888
|
+
const PathCommandNodeHelper = {
|
|
2889
|
+
toCommand(_nodes) {
|
|
2890
|
+
return [];
|
|
2891
|
+
},
|
|
2892
|
+
toNode(_data) {
|
|
2893
|
+
return [];
|
|
2894
|
+
}
|
|
2895
|
+
};
|
|
2896
|
+
|
|
2881
2897
|
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
|
|
2882
2898
|
|
|
2883
2899
|
const {rect: rect$1, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$3, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
@@ -3156,30 +3172,34 @@ const PathConvert = {
|
|
|
3156
3172
|
return data;
|
|
3157
3173
|
},
|
|
3158
3174
|
objectToCanvasData(list) {
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3175
|
+
if (list[0].name.length > 1) {
|
|
3176
|
+
return PathCommandNodeHelper.toCommand(list);
|
|
3177
|
+
} else {
|
|
3178
|
+
const data = [];
|
|
3179
|
+
list.forEach(item => {
|
|
3180
|
+
switch (item.name) {
|
|
3181
|
+
case "M":
|
|
3182
|
+
data.push(M$4, item.x, item.y);
|
|
3183
|
+
break;
|
|
3165
3184
|
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3185
|
+
case "L":
|
|
3186
|
+
data.push(L$5, item.x, item.y);
|
|
3187
|
+
break;
|
|
3169
3188
|
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3189
|
+
case "C":
|
|
3190
|
+
data.push(C$3, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
3191
|
+
break;
|
|
3173
3192
|
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3193
|
+
case "Q":
|
|
3194
|
+
data.push(Q$3, item.x1, item.y1, item.x, item.y);
|
|
3195
|
+
break;
|
|
3177
3196
|
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3197
|
+
case "Z":
|
|
3198
|
+
data.push(Z$4);
|
|
3199
|
+
}
|
|
3200
|
+
});
|
|
3201
|
+
return data;
|
|
3202
|
+
}
|
|
3183
3203
|
},
|
|
3184
3204
|
copyData(data, old, index, count) {
|
|
3185
3205
|
for (let i = index, end = index + count; i < end; i++) {
|
|
@@ -6837,7 +6857,7 @@ class LeafLevelList {
|
|
|
6837
6857
|
}
|
|
6838
6858
|
}
|
|
6839
6859
|
|
|
6840
|
-
const version = "1.
|
|
6860
|
+
const version = "1.11.0";
|
|
6841
6861
|
|
|
6842
6862
|
exports.AlignHelper = AlignHelper;
|
|
6843
6863
|
|
|
@@ -6935,6 +6955,8 @@ exports.PathCommandDataHelper = PathCommandDataHelper;
|
|
|
6935
6955
|
|
|
6936
6956
|
exports.PathCommandMap = PathCommandMap;
|
|
6937
6957
|
|
|
6958
|
+
exports.PathCommandNodeHelper = PathCommandNodeHelper;
|
|
6959
|
+
|
|
6938
6960
|
exports.PathConvert = PathConvert;
|
|
6939
6961
|
|
|
6940
6962
|
exports.PathCorner = PathCorner;
|
package/lib/core.esm.js
CHANGED
|
@@ -872,9 +872,10 @@ const PointHelper = {
|
|
|
872
872
|
getAtan2(t, to) {
|
|
873
873
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
874
874
|
},
|
|
875
|
-
getDistancePoint(t, to, distance, changeTo) {
|
|
875
|
+
getDistancePoint(t, to, distance, changeTo, fromTo) {
|
|
876
876
|
const r = getAtan2(t, to);
|
|
877
|
-
|
|
877
|
+
fromTo && (t = to);
|
|
878
|
+
changeTo || (to = {});
|
|
878
879
|
to.x = t.x + cos$2(r) * distance;
|
|
879
880
|
to.y = t.y + sin$2(r) * distance;
|
|
880
881
|
return to;
|
|
@@ -884,6 +885,9 @@ const PointHelper = {
|
|
|
884
885
|
if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
885
886
|
return points;
|
|
886
887
|
},
|
|
888
|
+
isSame(t, point) {
|
|
889
|
+
return t.x === point.x && t.y === point.y;
|
|
890
|
+
},
|
|
887
891
|
reset(t) {
|
|
888
892
|
P$5.reset(t);
|
|
889
893
|
}
|
|
@@ -948,8 +952,8 @@ class Point {
|
|
|
948
952
|
getDistance(to) {
|
|
949
953
|
return PointHelper.getDistance(this, to);
|
|
950
954
|
}
|
|
951
|
-
getDistancePoint(to, distance, changeTo) {
|
|
952
|
-
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo));
|
|
955
|
+
getDistancePoint(to, distance, changeTo, fromTo) {
|
|
956
|
+
return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
|
|
953
957
|
}
|
|
954
958
|
getAngle(to) {
|
|
955
959
|
return PointHelper.getAngle(this, to);
|
|
@@ -957,6 +961,9 @@ class Point {
|
|
|
957
961
|
getAtan2(to) {
|
|
958
962
|
return PointHelper.getAtan2(this, to);
|
|
959
963
|
}
|
|
964
|
+
isSame(point) {
|
|
965
|
+
return PointHelper.isSame(this, point);
|
|
966
|
+
}
|
|
960
967
|
reset() {
|
|
961
968
|
PointHelper.reset(this);
|
|
962
969
|
return this;
|
|
@@ -2876,6 +2883,15 @@ const EllipseHelper = {
|
|
|
2876
2883
|
}
|
|
2877
2884
|
};
|
|
2878
2885
|
|
|
2886
|
+
const PathCommandNodeHelper = {
|
|
2887
|
+
toCommand(_nodes) {
|
|
2888
|
+
return [];
|
|
2889
|
+
},
|
|
2890
|
+
toNode(_data) {
|
|
2891
|
+
return [];
|
|
2892
|
+
}
|
|
2893
|
+
};
|
|
2894
|
+
|
|
2879
2895
|
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
|
|
2880
2896
|
|
|
2881
2897
|
const {rect: rect$1, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$3, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
@@ -3154,30 +3170,34 @@ const PathConvert = {
|
|
|
3154
3170
|
return data;
|
|
3155
3171
|
},
|
|
3156
3172
|
objectToCanvasData(list) {
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3173
|
+
if (list[0].name.length > 1) {
|
|
3174
|
+
return PathCommandNodeHelper.toCommand(list);
|
|
3175
|
+
} else {
|
|
3176
|
+
const data = [];
|
|
3177
|
+
list.forEach(item => {
|
|
3178
|
+
switch (item.name) {
|
|
3179
|
+
case "M":
|
|
3180
|
+
data.push(M$4, item.x, item.y);
|
|
3181
|
+
break;
|
|
3163
3182
|
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3183
|
+
case "L":
|
|
3184
|
+
data.push(L$5, item.x, item.y);
|
|
3185
|
+
break;
|
|
3167
3186
|
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3187
|
+
case "C":
|
|
3188
|
+
data.push(C$3, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
3189
|
+
break;
|
|
3171
3190
|
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3191
|
+
case "Q":
|
|
3192
|
+
data.push(Q$3, item.x1, item.y1, item.x, item.y);
|
|
3193
|
+
break;
|
|
3175
3194
|
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3195
|
+
case "Z":
|
|
3196
|
+
data.push(Z$4);
|
|
3197
|
+
}
|
|
3198
|
+
});
|
|
3199
|
+
return data;
|
|
3200
|
+
}
|
|
3181
3201
|
},
|
|
3182
3202
|
copyData(data, old, index, count) {
|
|
3183
3203
|
for (let i = index, end = index + count; i < end; i++) {
|
|
@@ -6835,6 +6855,6 @@ class LeafLevelList {
|
|
|
6835
6855
|
}
|
|
6836
6856
|
}
|
|
6837
6857
|
|
|
6838
|
-
const version = "1.
|
|
6858
|
+
const version = "1.11.0";
|
|
6839
6859
|
|
|
6840
|
-
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, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, 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 };
|
|
6860
|
+
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, LeaferImage, 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, 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 };
|