leafer-ui 2.2.11 → 2.3.1
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/README.md +16 -237
- package/dist/web.js +59 -22
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +63 -23
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.module.js
CHANGED
|
@@ -470,7 +470,7 @@ function getMatrixData() {
|
|
|
470
470
|
|
|
471
471
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
472
472
|
|
|
473
|
-
const {float: float$
|
|
473
|
+
const {float: float$4} = MathHelper;
|
|
474
474
|
|
|
475
475
|
const tempPoint$5 = {};
|
|
476
476
|
|
|
@@ -721,12 +721,12 @@ const MatrixHelper = {
|
|
|
721
721
|
const cosR = c / scaleY;
|
|
722
722
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
723
723
|
}
|
|
724
|
-
const cosR = float$
|
|
724
|
+
const cosR = float$4(cos$5(rotation));
|
|
725
725
|
const sinR = sin$5(rotation);
|
|
726
|
-
scaleX = float$
|
|
727
|
-
skewX = cosR ? float$
|
|
728
|
-
skewY = cosR ? float$
|
|
729
|
-
rotation = float$
|
|
726
|
+
scaleX = float$4(scaleX), scaleY = float$4(scaleY);
|
|
727
|
+
skewX = cosR ? float$4((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
728
|
+
skewY = cosR ? float$4((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
729
|
+
rotation = float$4(rotation / OneRadian);
|
|
730
730
|
} else {
|
|
731
731
|
scaleX = a;
|
|
732
732
|
scaleY = d;
|
|
@@ -770,7 +770,7 @@ const MatrixHelper = {
|
|
|
770
770
|
|
|
771
771
|
const M$6 = MatrixHelper;
|
|
772
772
|
|
|
773
|
-
const {float: float$
|
|
773
|
+
const {float: float$3} = MathHelper;
|
|
774
774
|
|
|
775
775
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
776
776
|
|
|
@@ -916,7 +916,7 @@ const PointHelper = {
|
|
|
916
916
|
return points;
|
|
917
917
|
},
|
|
918
918
|
isSame(t, point, quick) {
|
|
919
|
-
return quick ? t.x === point.x && t.y === point.y : float$
|
|
919
|
+
return quick ? t.x === point.x && t.y === point.y : float$3(t.x) === float$3(point.x) && float$3(t.y) === float$3(point.y);
|
|
920
920
|
},
|
|
921
921
|
reset(t) {
|
|
922
922
|
t.x = t.y = 0;
|
|
@@ -1272,7 +1272,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPo
|
|
|
1272
1272
|
|
|
1273
1273
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1274
1274
|
|
|
1275
|
-
const {float: float$
|
|
1275
|
+
const {float: float$2, fourNumber: fourNumber} = MathHelper;
|
|
1276
1276
|
|
|
1277
1277
|
const {floor: floor$1, ceil: ceil$1} = Math;
|
|
1278
1278
|
|
|
@@ -1447,10 +1447,10 @@ const BoundsHelper = {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
},
|
|
1449
1449
|
float(t, maxLength) {
|
|
1450
|
-
t.x = float$
|
|
1451
|
-
t.y = float$
|
|
1452
|
-
t.width = float$
|
|
1453
|
-
t.height = float$
|
|
1450
|
+
t.x = float$2(t.x, maxLength);
|
|
1451
|
+
t.y = float$2(t.y, maxLength);
|
|
1452
|
+
t.width = float$2(t.width, maxLength);
|
|
1453
|
+
t.height = float$2(t.height, maxLength);
|
|
1454
1454
|
},
|
|
1455
1455
|
add(t, bounds, isPoint) {
|
|
1456
1456
|
right$1 = t.x + t.width;
|
|
@@ -3742,6 +3742,8 @@ const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
|
3742
3742
|
|
|
3743
3743
|
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
3744
3744
|
|
|
3745
|
+
const {float: float$1} = MathHelper;
|
|
3746
|
+
|
|
3745
3747
|
const PathCorner = {
|
|
3746
3748
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3747
3749
|
let command, lastCommand, commandLen, startXIndex, startYIndex, smoothLen;
|
|
@@ -3782,7 +3784,8 @@ const PathCorner = {
|
|
|
3782
3784
|
break;
|
|
3783
3785
|
|
|
3784
3786
|
case Z:
|
|
3785
|
-
|
|
3787
|
+
if (float$1(x) === float$1(startX) && float$1(y) === float$1(startY)) x = lastX,
|
|
3788
|
+
y = lastY; else arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3786
3789
|
break;
|
|
3787
3790
|
|
|
3788
3791
|
default:
|
|
@@ -5022,10 +5025,11 @@ const LeafHelper = {
|
|
|
5022
5025
|
hasOffset(t) {
|
|
5023
5026
|
return t.offsetX || t.offsetY;
|
|
5024
5027
|
},
|
|
5025
|
-
hasParent(p, parent) {
|
|
5028
|
+
hasParent(p, parent, minLevel) {
|
|
5026
5029
|
if (!parent) return false;
|
|
5027
5030
|
while (p) {
|
|
5028
5031
|
if (parent === p) return true;
|
|
5032
|
+
if (minLevel && p.__level === minLevel) return;
|
|
5029
5033
|
p = p.parent;
|
|
5030
5034
|
}
|
|
5031
5035
|
},
|
|
@@ -5043,6 +5047,10 @@ const LeafHelper = {
|
|
|
5043
5047
|
}
|
|
5044
5048
|
};
|
|
5045
5049
|
|
|
5050
|
+
function isTrackChanges(leafer) {
|
|
5051
|
+
return leafer && leafer.config.trackChanges;
|
|
5052
|
+
}
|
|
5053
|
+
|
|
5046
5054
|
const L = LeafHelper;
|
|
5047
5055
|
|
|
5048
5056
|
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange} = L;
|
|
@@ -5097,6 +5105,16 @@ const BranchHelper = {
|
|
|
5097
5105
|
sort(a, b) {
|
|
5098
5106
|
return a.__.zIndex === b.__.zIndex ? a.__tempNumber - b.__tempNumber : a.__.zIndex - b.__.zIndex;
|
|
5099
5107
|
},
|
|
5108
|
+
zIndex(branch, child, index) {
|
|
5109
|
+
const {children: children} = branch, before = children[index - 1], after = children[index];
|
|
5110
|
+
if (before && after) {
|
|
5111
|
+
if (child.zIndex < before.zIndex || child.zIndex > after.zIndex) child.zIndex = (before.zIndex + after.zIndex) / 2;
|
|
5112
|
+
} else if (before) {
|
|
5113
|
+
if (child.zIndex < before.zIndex) child.zIndex = before.zIndex + 1;
|
|
5114
|
+
} else if (after) {
|
|
5115
|
+
if (child.zIndex > after.zIndex) child.zIndex = after.zIndex - 1;
|
|
5116
|
+
}
|
|
5117
|
+
},
|
|
5100
5118
|
pushAllChildBranch(branch, leafList) {
|
|
5101
5119
|
branch.__tempNumber = 1;
|
|
5102
5120
|
if (branch.__.__childBranchNumber) {
|
|
@@ -6063,7 +6081,7 @@ const LeafDataProxy = {
|
|
|
6063
6081
|
},
|
|
6064
6082
|
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
6065
6083
|
const {leafer: leafer} = this;
|
|
6066
|
-
if (leafer
|
|
6084
|
+
if (isTrackChanges(leafer) || leafer.zoomLayer === this) {
|
|
6067
6085
|
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
6068
6086
|
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
6069
6087
|
leafer.emitEvent(event);
|
|
@@ -6518,7 +6536,6 @@ let Leaf = class Leaf {
|
|
|
6518
6536
|
}
|
|
6519
6537
|
}
|
|
6520
6538
|
__bindFrame(frame) {
|
|
6521
|
-
if (this.isFrame && frame !== null) frame = this;
|
|
6522
6539
|
this.frame = frame;
|
|
6523
6540
|
if (this.isBranch) {
|
|
6524
6541
|
const {children: children} = this;
|
|
@@ -6551,6 +6568,7 @@ let Leaf = class Leaf {
|
|
|
6551
6568
|
this.__layout.update();
|
|
6552
6569
|
}
|
|
6553
6570
|
forceUpdate(typeOrAttrName) {
|
|
6571
|
+
if (this.__hasComplex) LeafHelper.updateComplex(this);
|
|
6554
6572
|
let quick;
|
|
6555
6573
|
if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
|
|
6556
6574
|
quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
|
|
@@ -6829,14 +6847,17 @@ let Branch = class Branch extends Leaf {
|
|
|
6829
6847
|
}
|
|
6830
6848
|
if (child.parent) child.parent.remove(child);
|
|
6831
6849
|
child.parent = this;
|
|
6832
|
-
noIndex
|
|
6850
|
+
if (noIndex) this.children.push(child); else {
|
|
6851
|
+
BranchHelper.zIndex(this, child, index);
|
|
6852
|
+
this.children.splice(index, 0, child);
|
|
6853
|
+
}
|
|
6833
6854
|
if (child.isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
6834
6855
|
const childLayout = child.__layout;
|
|
6835
6856
|
childLayout.boxChanged || childLayout.boxChange();
|
|
6836
6857
|
childLayout.matrixChanged || childLayout.matrixChange();
|
|
6837
6858
|
if (child.__parentChange) child.__parentChange.forEach(item => item(this, child));
|
|
6838
6859
|
if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
|
|
6839
|
-
if (this.
|
|
6860
|
+
if (this.frame) child.__bindFrame(this.frame);
|
|
6840
6861
|
if (this.leafer) {
|
|
6841
6862
|
child.__bindLeafer(this.leafer);
|
|
6842
6863
|
if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
|
|
@@ -6896,11 +6917,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6896
6917
|
if (this.leafer.hitCanvasManager) this.leafer.hitCanvasManager.clear();
|
|
6897
6918
|
}
|
|
6898
6919
|
}
|
|
6899
|
-
if (
|
|
6920
|
+
if (child.frame && !child.isFrame) child.__bindFrame(null);
|
|
6900
6921
|
}
|
|
6901
6922
|
__emitChildEvent(type, child) {
|
|
6902
6923
|
const {leafer: leafer} = this;
|
|
6903
|
-
if (leafer
|
|
6924
|
+
if (isTrackChanges(leafer) || leafer.zoomLayer === this) {
|
|
6904
6925
|
const event = new ChildEvent(type, child, this);
|
|
6905
6926
|
if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event);
|
|
6906
6927
|
leafer.emitEvent(event);
|
|
@@ -7057,7 +7078,13 @@ class LeafLevelList {
|
|
|
7057
7078
|
}
|
|
7058
7079
|
}
|
|
7059
7080
|
|
|
7060
|
-
const version = "2.
|
|
7081
|
+
const version = "2.3.1";
|
|
7082
|
+
|
|
7083
|
+
if (typeof globalThis !== "undefined") {
|
|
7084
|
+
const globalLeafer = globalThis.Leafer || (globalThis.Leafer = {});
|
|
7085
|
+
globalLeafer.version = version;
|
|
7086
|
+
globalLeafer.Plugin = Plugin;
|
|
7087
|
+
}
|
|
7061
7088
|
|
|
7062
7089
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
7063
7090
|
|
|
@@ -8203,6 +8230,17 @@ function zoomLayerType() {
|
|
|
8203
8230
|
};
|
|
8204
8231
|
}
|
|
8205
8232
|
|
|
8233
|
+
function frameType() {
|
|
8234
|
+
return (target, key) => {
|
|
8235
|
+
defineKey(target, key, {
|
|
8236
|
+
set(_value) {},
|
|
8237
|
+
get() {
|
|
8238
|
+
return this;
|
|
8239
|
+
}
|
|
8240
|
+
});
|
|
8241
|
+
};
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8206
8244
|
function createAttr(defaultValue) {
|
|
8207
8245
|
return (target, key) => {
|
|
8208
8246
|
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
@@ -9606,6 +9644,8 @@ let Frame = class Frame extends Box {
|
|
|
9606
9644
|
}
|
|
9607
9645
|
};
|
|
9608
9646
|
|
|
9647
|
+
__decorate([ frameType() ], Frame.prototype, "frame", void 0);
|
|
9648
|
+
|
|
9609
9649
|
__decorate([ dataProcessor(FrameData) ], Frame.prototype, "__", void 0);
|
|
9610
9650
|
|
|
9611
9651
|
__decorate([ surfaceType("#FFFFFF") ], Frame.prototype, "fill", void 0);
|
|
@@ -13707,4 +13747,4 @@ Object.assign(Creator, {
|
|
|
13707
13747
|
|
|
13708
13748
|
useCanvas();
|
|
13709
13749
|
|
|
13710
|
-
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, LayouterHelper, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, 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, registerPointsCurve, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
13750
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, LayouterHelper, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, emptyData, eraserType, extraPropertyEventMap, frameType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isTrackChanges, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerPointsCurve, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|