leafer-ui 1.0.0-rc.16 → 1.0.0-rc.18
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 +1 -1
- package/dist/web.esm.js +39 -21
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +831 -607
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +828 -608
- package/dist/web.module.min.js +1 -1
- package/package.json +3 -3
package/dist/web.module.js
CHANGED
|
@@ -38,6 +38,18 @@ const MathHelper = {
|
|
|
38
38
|
value = max;
|
|
39
39
|
return value;
|
|
40
40
|
},
|
|
41
|
+
minus(value, isFourNumber) {
|
|
42
|
+
if (value instanceof Array) {
|
|
43
|
+
if (isFourNumber)
|
|
44
|
+
value = MathHelper.fourNumber(value);
|
|
45
|
+
for (let i = 0; i < value.length; i++)
|
|
46
|
+
value[i] = -value[i];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
value = -value;
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
},
|
|
41
53
|
fourNumber(num, maxValue) {
|
|
42
54
|
let data;
|
|
43
55
|
if (num instanceof Array) {
|
|
@@ -721,7 +733,7 @@ const { addPoint: addPoint$4 } = TwoPointBoundsHelper;
|
|
|
721
733
|
|
|
722
734
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$3, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
723
735
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
724
|
-
const { float } = MathHelper;
|
|
736
|
+
const { float, fourNumber } = MathHelper;
|
|
725
737
|
const { floor, ceil: ceil$2 } = Math;
|
|
726
738
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
727
739
|
const point = {};
|
|
@@ -741,9 +753,15 @@ const BoundsHelper = {
|
|
|
741
753
|
t.height = bounds.height;
|
|
742
754
|
},
|
|
743
755
|
copyAndSpread(t, bounds, spreadX, spreadY) {
|
|
744
|
-
if (
|
|
745
|
-
|
|
746
|
-
|
|
756
|
+
if (spreadX instanceof Array) {
|
|
757
|
+
const four = fourNumber(spreadX);
|
|
758
|
+
B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
if (!spreadY)
|
|
762
|
+
spreadY = spreadX;
|
|
763
|
+
B.set(t, bounds.x - spreadX, bounds.y - spreadY, bounds.width + spreadX * 2, bounds.height + spreadY * 2);
|
|
764
|
+
}
|
|
747
765
|
},
|
|
748
766
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
749
767
|
minY(t) { return t.height > 0 ? t.y : t.y + t.height; },
|
|
@@ -1021,8 +1039,12 @@ class Bounds {
|
|
|
1021
1039
|
getFitMatrix(put) {
|
|
1022
1040
|
return BoundsHelper.getFitMatrix(this, put);
|
|
1023
1041
|
}
|
|
1024
|
-
spread(
|
|
1025
|
-
BoundsHelper.spread(this,
|
|
1042
|
+
spread(fourNumber, spreadY) {
|
|
1043
|
+
BoundsHelper.spread(this, fourNumber, spreadY);
|
|
1044
|
+
return this;
|
|
1045
|
+
}
|
|
1046
|
+
shrink(fourNumber) {
|
|
1047
|
+
BoundsHelper.spread(this, MathHelper.minus(fourNumber, true));
|
|
1026
1048
|
return this;
|
|
1027
1049
|
}
|
|
1028
1050
|
ceil() {
|
|
@@ -1447,17 +1469,30 @@ class LeafData {
|
|
|
1447
1469
|
if (this.__input && this.__input[name] !== undefined)
|
|
1448
1470
|
this.__input[name] = undefined;
|
|
1449
1471
|
}
|
|
1450
|
-
__getInputData() {
|
|
1451
|
-
const data = {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1472
|
+
__getInputData(names) {
|
|
1473
|
+
const data = {};
|
|
1474
|
+
if (names) {
|
|
1475
|
+
if (names instanceof Array) {
|
|
1476
|
+
for (let name of names)
|
|
1477
|
+
data[name] = this.__getInput(name);
|
|
1478
|
+
}
|
|
1479
|
+
else {
|
|
1480
|
+
for (let name in names)
|
|
1481
|
+
data[name] = this.__getInput(name);
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
else {
|
|
1485
|
+
let value, inputValue, { __input } = this;
|
|
1486
|
+
data.tag = this.__leaf.tag;
|
|
1487
|
+
for (let key in this) {
|
|
1488
|
+
if (key[0] !== '_') {
|
|
1489
|
+
value = this['_' + key];
|
|
1490
|
+
if (value !== undefined) {
|
|
1491
|
+
if (key === 'path' && !this.__pathInputed)
|
|
1492
|
+
continue;
|
|
1493
|
+
inputValue = __input ? __input[key] : undefined;
|
|
1494
|
+
data[key] = (inputValue === undefined) ? value : inputValue;
|
|
1495
|
+
}
|
|
1461
1496
|
}
|
|
1462
1497
|
}
|
|
1463
1498
|
}
|
|
@@ -2818,12 +2853,16 @@ class PathCreator {
|
|
|
2818
2853
|
set path(value) { this.__path = value; }
|
|
2819
2854
|
get path() { return this.__path; }
|
|
2820
2855
|
constructor(path) {
|
|
2856
|
+
this.set(path);
|
|
2857
|
+
}
|
|
2858
|
+
set(path) {
|
|
2821
2859
|
if (path) {
|
|
2822
2860
|
this.__path = typeof path === 'string' ? PathHelper.parse(path) : path;
|
|
2823
2861
|
}
|
|
2824
2862
|
else {
|
|
2825
2863
|
this.__path = [];
|
|
2826
2864
|
}
|
|
2865
|
+
return this;
|
|
2827
2866
|
}
|
|
2828
2867
|
beginPath() {
|
|
2829
2868
|
beginPath(this.__path);
|
|
@@ -3137,6 +3176,7 @@ const PathCorner = {
|
|
|
3137
3176
|
PathHelper.creator = new PathCreator();
|
|
3138
3177
|
PathHelper.parse = PathConvert.parse;
|
|
3139
3178
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3179
|
+
const pen = new PathCreator();
|
|
3140
3180
|
|
|
3141
3181
|
const { drawRoundRect } = RectHelper;
|
|
3142
3182
|
function roundRect(drawer) {
|
|
@@ -3421,7 +3461,7 @@ const ImageManager = {
|
|
|
3421
3461
|
},
|
|
3422
3462
|
clearRecycled() {
|
|
3423
3463
|
const list = I$1.recycledList;
|
|
3424
|
-
if (list.length) {
|
|
3464
|
+
if (list.length > 100) {
|
|
3425
3465
|
list.forEach(image => {
|
|
3426
3466
|
if (!image.use && image.url) {
|
|
3427
3467
|
delete I$1.map[image.url];
|
|
@@ -3673,6 +3713,8 @@ function affectStrokeBoundsType(defaultValue) {
|
|
|
3673
3713
|
}
|
|
3674
3714
|
function doStrokeType(leaf) {
|
|
3675
3715
|
leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
|
|
3716
|
+
if (leaf.__.__useArrow)
|
|
3717
|
+
doBoundsType(leaf);
|
|
3676
3718
|
}
|
|
3677
3719
|
const strokeType = affectStrokeBoundsType;
|
|
3678
3720
|
function affectRenderBoundsType(defaultValue) {
|
|
@@ -3876,131 +3918,411 @@ function registerUIEvent() {
|
|
|
3876
3918
|
};
|
|
3877
3919
|
}
|
|
3878
3920
|
|
|
3879
|
-
const
|
|
3880
|
-
const
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
get e() { return this.leaf.__.x; }
|
|
3891
|
-
get f() { return this.leaf.__.y; }
|
|
3892
|
-
get x() { return this.e + this.boxBounds.x; }
|
|
3893
|
-
get y() { return this.f + this.boxBounds.y; }
|
|
3894
|
-
get width() { return this.boxBounds.width; }
|
|
3895
|
-
get height() { return this.boxBounds.height; }
|
|
3896
|
-
constructor(leaf) {
|
|
3897
|
-
this.leaf = leaf;
|
|
3898
|
-
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
3899
|
-
if (this.leaf.__local)
|
|
3900
|
-
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
3901
|
-
this.boxChange();
|
|
3902
|
-
this.matrixChange();
|
|
3903
|
-
}
|
|
3904
|
-
createLocal() {
|
|
3905
|
-
const local = this.leaf.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
3906
|
-
if (!this._localStrokeBounds)
|
|
3907
|
-
this._localStrokeBounds = local;
|
|
3908
|
-
if (!this._localRenderBounds)
|
|
3909
|
-
this._localRenderBounds = local;
|
|
3910
|
-
}
|
|
3911
|
-
update() {
|
|
3912
|
-
const { leafer } = this.leaf;
|
|
3913
|
-
if (leafer) {
|
|
3914
|
-
if (leafer.ready) {
|
|
3915
|
-
if (leafer.watcher.changed)
|
|
3916
|
-
leafer.layouter.layout();
|
|
3921
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3922
|
+
const matrix = {};
|
|
3923
|
+
const LeafHelper = {
|
|
3924
|
+
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
3925
|
+
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
3926
|
+
waitAutoLayout = true;
|
|
3927
|
+
updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
|
|
3928
|
+
if (leaf.isBranch) {
|
|
3929
|
+
const { children } = leaf;
|
|
3930
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3931
|
+
updateAllMatrix$3(children[i], checkAutoLayout, waitAutoLayout);
|
|
3917
3932
|
}
|
|
3918
|
-
|
|
3919
|
-
|
|
3933
|
+
}
|
|
3934
|
+
},
|
|
3935
|
+
updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
3936
|
+
const layout = leaf.__layout;
|
|
3937
|
+
if (checkAutoLayout) {
|
|
3938
|
+
if (waitAutoLayout) {
|
|
3939
|
+
layout.waitAutoLayout = true;
|
|
3940
|
+
if (leaf.__hasAutoLayout)
|
|
3941
|
+
layout.matrixChanged = false;
|
|
3920
3942
|
}
|
|
3921
3943
|
}
|
|
3922
|
-
else {
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3944
|
+
else if (layout.waitAutoLayout) {
|
|
3945
|
+
layout.waitAutoLayout = false;
|
|
3946
|
+
}
|
|
3947
|
+
if (layout.matrixChanged)
|
|
3948
|
+
leaf.__updateLocalMatrix();
|
|
3949
|
+
if (!layout.waitAutoLayout)
|
|
3950
|
+
leaf.__updateWorldMatrix();
|
|
3951
|
+
},
|
|
3952
|
+
updateBounds(leaf) {
|
|
3953
|
+
const layout = leaf.__layout;
|
|
3954
|
+
if (layout.boundsChanged)
|
|
3955
|
+
leaf.__updateLocalBounds();
|
|
3956
|
+
if (!layout.waitAutoLayout)
|
|
3957
|
+
leaf.__updateWorldBounds();
|
|
3958
|
+
},
|
|
3959
|
+
updateAllWorldOpacity(leaf) {
|
|
3960
|
+
leaf.__updateWorldOpacity();
|
|
3961
|
+
if (leaf.isBranch) {
|
|
3962
|
+
const { children } = leaf;
|
|
3963
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3964
|
+
updateAllWorldOpacity$1(children[i]);
|
|
3926
3965
|
}
|
|
3927
|
-
Platform.layout(root);
|
|
3928
3966
|
}
|
|
3929
|
-
}
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
return MatrixHelper.defaultMatrix;
|
|
3939
|
-
default:
|
|
3940
|
-
return new Matrix(this.leaf.__world).divideParent(relative.__world);
|
|
3967
|
+
},
|
|
3968
|
+
updateAllChange(leaf) {
|
|
3969
|
+
updateAllWorldOpacity$1(leaf);
|
|
3970
|
+
leaf.__updateChange();
|
|
3971
|
+
if (leaf.isBranch) {
|
|
3972
|
+
const { children } = leaf;
|
|
3973
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3974
|
+
updateAllChange$1(children[i]);
|
|
3975
|
+
}
|
|
3941
3976
|
}
|
|
3942
|
-
}
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
case 'local':
|
|
3949
|
-
return this.getLocalBounds(type);
|
|
3950
|
-
case 'inner':
|
|
3951
|
-
return this.getInnerBounds(type);
|
|
3952
|
-
default:
|
|
3953
|
-
return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
|
|
3977
|
+
},
|
|
3978
|
+
worldHittable(t) {
|
|
3979
|
+
while (t) {
|
|
3980
|
+
if (!t.__.hittable)
|
|
3981
|
+
return false;
|
|
3982
|
+
t = t.parent;
|
|
3954
3983
|
}
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3984
|
+
return true;
|
|
3985
|
+
},
|
|
3986
|
+
moveWorld(t, x, y) {
|
|
3987
|
+
const local = { x, y };
|
|
3988
|
+
if (t.parent)
|
|
3989
|
+
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3990
|
+
L.moveLocal(t, local.x, local.y);
|
|
3991
|
+
},
|
|
3992
|
+
moveLocal(t, x, y = 0) {
|
|
3993
|
+
t.x += x;
|
|
3994
|
+
t.y += y;
|
|
3995
|
+
},
|
|
3996
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
3997
|
+
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
3998
|
+
},
|
|
3999
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4000
|
+
copy$6(matrix, t.__localMatrix);
|
|
4001
|
+
scaleOfOuter$3(matrix, origin, scaleX, scaleY);
|
|
4002
|
+
moveByMatrix(t, matrix);
|
|
4003
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4004
|
+
},
|
|
4005
|
+
rotateOfWorld(t, origin, angle) {
|
|
4006
|
+
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4007
|
+
},
|
|
4008
|
+
rotateOfLocal(t, origin, angle) {
|
|
4009
|
+
copy$6(matrix, t.__localMatrix);
|
|
4010
|
+
rotateOfOuter$3(matrix, origin, angle);
|
|
4011
|
+
moveByMatrix(t, matrix);
|
|
4012
|
+
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4013
|
+
},
|
|
4014
|
+
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4015
|
+
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4016
|
+
},
|
|
4017
|
+
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4018
|
+
copy$6(matrix, t.__localMatrix);
|
|
4019
|
+
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4020
|
+
L.setTransform(t, matrix, resize);
|
|
4021
|
+
},
|
|
4022
|
+
transformWorld(t, transform, resize) {
|
|
4023
|
+
copy$6(matrix, t.worldTransform);
|
|
4024
|
+
multiplyParent$2(matrix, transform);
|
|
4025
|
+
if (t.parent)
|
|
4026
|
+
divideParent(matrix, t.parent.worldTransform);
|
|
4027
|
+
L.setTransform(t, matrix, resize);
|
|
4028
|
+
},
|
|
4029
|
+
transform(t, transform, resize) {
|
|
4030
|
+
copy$6(matrix, t.localTransform);
|
|
4031
|
+
multiplyParent$2(matrix, transform);
|
|
4032
|
+
L.setTransform(t, matrix, resize);
|
|
4033
|
+
},
|
|
4034
|
+
setTransform(t, transform, resize) {
|
|
4035
|
+
const layout = getLayout(transform);
|
|
4036
|
+
if (resize) {
|
|
4037
|
+
t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
|
|
4038
|
+
delete layout.scaleX;
|
|
4039
|
+
delete layout.scaleY;
|
|
3968
4040
|
}
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4041
|
+
t.set(layout);
|
|
4042
|
+
},
|
|
4043
|
+
getRelativeWorld(t, relative, temp) {
|
|
4044
|
+
copy$6(matrix, t.worldTransform);
|
|
4045
|
+
divideParent(matrix, relative.worldTransform);
|
|
4046
|
+
return temp ? matrix : Object.assign({}, matrix);
|
|
4047
|
+
},
|
|
4048
|
+
drop(t, parent, index, resize) {
|
|
4049
|
+
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4050
|
+
parent.add(t, index);
|
|
4051
|
+
},
|
|
4052
|
+
hasParent(p, parent) {
|
|
4053
|
+
if (!parent)
|
|
4054
|
+
return false;
|
|
4055
|
+
while (p) {
|
|
4056
|
+
if (parent === p)
|
|
4057
|
+
return true;
|
|
4058
|
+
p = p.parent;
|
|
3980
4059
|
}
|
|
3981
|
-
}
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
if (this.contentBounds)
|
|
3988
|
-
return this.getWorldContentBounds();
|
|
3989
|
-
case 'margin':
|
|
3990
|
-
case 'box':
|
|
3991
|
-
return this.getWorldBoxBounds();
|
|
3992
|
-
case 'margin':
|
|
3993
|
-
case 'stroke':
|
|
3994
|
-
return this.getWorldStrokeBounds();
|
|
4060
|
+
},
|
|
4061
|
+
hasParentAutoLayout(p) {
|
|
4062
|
+
while (p.parent) {
|
|
4063
|
+
p = p.parent;
|
|
4064
|
+
if (p.__hasAutoLayout)
|
|
4065
|
+
return true;
|
|
3995
4066
|
}
|
|
3996
4067
|
}
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4068
|
+
};
|
|
4069
|
+
const L = LeafHelper;
|
|
4070
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
|
|
4071
|
+
function moveByMatrix(t, matrix) {
|
|
4072
|
+
const { e, f } = t.__localMatrix;
|
|
4073
|
+
t.x += matrix.e - e;
|
|
4074
|
+
t.y += matrix.f - f;
|
|
4075
|
+
}
|
|
4076
|
+
function getTempLocal(t, world) {
|
|
4077
|
+
t.__layout.update();
|
|
4078
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
const LeafBoundsHelper = {
|
|
4082
|
+
worldBounds(target) {
|
|
4083
|
+
return target.__world;
|
|
4084
|
+
},
|
|
4085
|
+
localBoxBounds(target) {
|
|
4086
|
+
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4087
|
+
},
|
|
4088
|
+
localStrokeBounds(target) {
|
|
4089
|
+
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4090
|
+
},
|
|
4091
|
+
localRenderBounds(target) {
|
|
4092
|
+
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4093
|
+
},
|
|
4094
|
+
maskLocalBoxBounds(target) {
|
|
4095
|
+
return target.__.mask ? target.__localBoxBounds : null;
|
|
4096
|
+
},
|
|
4097
|
+
maskLocalStrokeBounds(target) {
|
|
4098
|
+
return target.__.mask ? target.__layout.localStrokeBounds : null;
|
|
4099
|
+
},
|
|
4100
|
+
maskLocalRenderBounds(target) {
|
|
4101
|
+
return target.__.mask ? target.__layout.localRenderBounds : null;
|
|
4102
|
+
},
|
|
4103
|
+
excludeRenderBounds(child, options) {
|
|
4104
|
+
if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
|
|
4105
|
+
return true;
|
|
4106
|
+
if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
|
|
4107
|
+
return true;
|
|
4108
|
+
return false;
|
|
4109
|
+
}
|
|
4110
|
+
};
|
|
4111
|
+
|
|
4112
|
+
const { updateBounds: updateBounds$2 } = LeafHelper;
|
|
4113
|
+
const BranchHelper = {
|
|
4114
|
+
sort(a, b) {
|
|
4115
|
+
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
4116
|
+
},
|
|
4117
|
+
pushAllChildBranch(branch, leafList) {
|
|
4118
|
+
branch.__tempNumber = 1;
|
|
4119
|
+
if (branch.__.__childBranchNumber) {
|
|
4120
|
+
const { children } = branch;
|
|
4121
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4122
|
+
branch = children[i];
|
|
4123
|
+
if (branch.isBranch) {
|
|
4124
|
+
branch.__tempNumber = 1;
|
|
4125
|
+
leafList.add(branch);
|
|
4126
|
+
pushAllChildBranch$1(branch, leafList);
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
}
|
|
4130
|
+
},
|
|
4131
|
+
pushAllParent(leaf, leafList) {
|
|
4132
|
+
const { keys } = leafList;
|
|
4133
|
+
if (keys) {
|
|
4134
|
+
while (leaf.parent) {
|
|
4135
|
+
if (keys[leaf.parent.innerId] === undefined) {
|
|
4136
|
+
leafList.add(leaf.parent);
|
|
4137
|
+
leaf = leaf.parent;
|
|
4138
|
+
}
|
|
4139
|
+
else {
|
|
4140
|
+
break;
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
else {
|
|
4145
|
+
while (leaf.parent) {
|
|
4146
|
+
leafList.add(leaf.parent);
|
|
4147
|
+
leaf = leaf.parent;
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
},
|
|
4151
|
+
pushAllBranchStack(branch, pushList) {
|
|
4152
|
+
let start = pushList.length;
|
|
4153
|
+
const { children } = branch;
|
|
4154
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4155
|
+
if (children[i].isBranch) {
|
|
4156
|
+
pushList.push(children[i]);
|
|
4157
|
+
}
|
|
4158
|
+
}
|
|
4159
|
+
for (let i = start, len = pushList.length; i < len; i++) {
|
|
4160
|
+
pushAllBranchStack(pushList[i], pushList);
|
|
4161
|
+
}
|
|
4162
|
+
},
|
|
4163
|
+
updateBounds(branch, exclude) {
|
|
4164
|
+
const branchStack = [branch];
|
|
4165
|
+
pushAllBranchStack(branch, branchStack);
|
|
4166
|
+
updateBoundsByBranchStack(branchStack, exclude);
|
|
4167
|
+
},
|
|
4168
|
+
updateBoundsByBranchStack(branchStack, exclude) {
|
|
4169
|
+
let branch, children;
|
|
4170
|
+
for (let i = branchStack.length - 1; i > -1; i--) {
|
|
4171
|
+
branch = branchStack[i];
|
|
4172
|
+
children = branch.children;
|
|
4173
|
+
for (let j = 0, len = children.length; j < len; j++) {
|
|
4174
|
+
updateBounds$2(children[j]);
|
|
4175
|
+
}
|
|
4176
|
+
if (exclude && exclude === branch)
|
|
4177
|
+
continue;
|
|
4178
|
+
updateBounds$2(branch);
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
};
|
|
4182
|
+
const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
|
|
4183
|
+
|
|
4184
|
+
const WaitHelper = {
|
|
4185
|
+
run(wait) {
|
|
4186
|
+
if (wait.length) {
|
|
4187
|
+
const len = wait.length;
|
|
4188
|
+
for (let i = 0; i < len; i++) {
|
|
4189
|
+
wait[i]();
|
|
4190
|
+
}
|
|
4191
|
+
wait.length === len ? wait.length = 0 : wait.splice(0, len);
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
};
|
|
4195
|
+
|
|
4196
|
+
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4197
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4198
|
+
class LeafLayout {
|
|
4199
|
+
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4200
|
+
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4201
|
+
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4202
|
+
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4203
|
+
get a() { return 1; }
|
|
4204
|
+
get b() { return 0; }
|
|
4205
|
+
get c() { return 0; }
|
|
4206
|
+
get d() { return 1; }
|
|
4207
|
+
get e() { return this.leaf.__.x; }
|
|
4208
|
+
get f() { return this.leaf.__.y; }
|
|
4209
|
+
get x() { return this.e + this.boxBounds.x; }
|
|
4210
|
+
get y() { return this.f + this.boxBounds.y; }
|
|
4211
|
+
get width() { return this.boxBounds.width; }
|
|
4212
|
+
get height() { return this.boxBounds.height; }
|
|
4213
|
+
constructor(leaf) {
|
|
4214
|
+
this.leaf = leaf;
|
|
4215
|
+
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4216
|
+
if (this.leaf.__local)
|
|
4217
|
+
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
4218
|
+
this.boxChange();
|
|
4219
|
+
this.matrixChange();
|
|
4220
|
+
}
|
|
4221
|
+
createLocal() {
|
|
4222
|
+
const local = this.leaf.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
|
|
4223
|
+
if (!this._localStrokeBounds)
|
|
4224
|
+
this._localStrokeBounds = local;
|
|
4225
|
+
if (!this._localRenderBounds)
|
|
4226
|
+
this._localRenderBounds = local;
|
|
4227
|
+
}
|
|
4228
|
+
update() {
|
|
4229
|
+
const { leafer } = this.leaf;
|
|
4230
|
+
if (leafer) {
|
|
4231
|
+
if (leafer.ready) {
|
|
4232
|
+
if (leafer.watcher.changed)
|
|
4233
|
+
leafer.layouter.layout();
|
|
4234
|
+
}
|
|
4235
|
+
else {
|
|
4236
|
+
leafer.start();
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
else {
|
|
4240
|
+
let root = this.leaf;
|
|
4241
|
+
while (root.parent && !root.parent.leafer) {
|
|
4242
|
+
root = root.parent;
|
|
4243
|
+
}
|
|
4244
|
+
Platform.layout(root);
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
getTransform(relative = 'world') {
|
|
4248
|
+
this.update();
|
|
4249
|
+
const { leaf } = this;
|
|
4250
|
+
switch (relative) {
|
|
4251
|
+
case 'world':
|
|
4252
|
+
return leaf.__world;
|
|
4253
|
+
case 'local':
|
|
4254
|
+
return leaf.__localMatrix;
|
|
4255
|
+
case 'inner':
|
|
4256
|
+
return MatrixHelper.defaultMatrix;
|
|
4257
|
+
case 'page':
|
|
4258
|
+
relative = leaf.zoomLayer;
|
|
4259
|
+
default:
|
|
4260
|
+
return getRelativeWorld$1(leaf, relative);
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
getBounds(type, relative = 'world') {
|
|
4264
|
+
this.update();
|
|
4265
|
+
switch (relative) {
|
|
4266
|
+
case 'world':
|
|
4267
|
+
return this.getWorldBounds(type);
|
|
4268
|
+
case 'local':
|
|
4269
|
+
return this.getLocalBounds(type);
|
|
4270
|
+
case 'inner':
|
|
4271
|
+
return this.getInnerBounds(type);
|
|
4272
|
+
case 'page':
|
|
4273
|
+
relative = this.leaf.zoomLayer;
|
|
4274
|
+
default:
|
|
4275
|
+
return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
getInnerBounds(type = 'box') {
|
|
4279
|
+
switch (type) {
|
|
4280
|
+
case 'render':
|
|
4281
|
+
return this.renderBounds;
|
|
4282
|
+
case 'content':
|
|
4283
|
+
if (this.contentBounds)
|
|
4284
|
+
return this.contentBounds;
|
|
4285
|
+
case 'margin':
|
|
4286
|
+
case 'box':
|
|
4287
|
+
return this.boxBounds;
|
|
4288
|
+
case 'stroke':
|
|
4289
|
+
return this.strokeBounds;
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
getLocalBounds(type = 'box') {
|
|
4293
|
+
switch (type) {
|
|
4294
|
+
case 'render':
|
|
4295
|
+
return this.localRenderBounds;
|
|
4296
|
+
case 'stroke':
|
|
4297
|
+
return this.localStrokeBounds;
|
|
4298
|
+
case 'margin':
|
|
4299
|
+
case 'content':
|
|
4300
|
+
case 'box':
|
|
4301
|
+
return this.leaf.__localBoxBounds;
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
getWorldBounds(type = 'box') {
|
|
4305
|
+
switch (type) {
|
|
4306
|
+
case 'render':
|
|
4307
|
+
return this.leaf.__world;
|
|
4308
|
+
case 'content':
|
|
4309
|
+
if (this.contentBounds)
|
|
4310
|
+
return this.getWorldContentBounds();
|
|
4311
|
+
case 'margin':
|
|
4312
|
+
case 'box':
|
|
4313
|
+
return this.getWorldBoxBounds();
|
|
4314
|
+
case 'margin':
|
|
4315
|
+
case 'stroke':
|
|
4316
|
+
return this.getWorldStrokeBounds();
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4320
|
+
const { leaf } = this;
|
|
4321
|
+
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4322
|
+
switch (relative) {
|
|
4323
|
+
case 'world':
|
|
4324
|
+
point = leaf.getWorldPoint(bounds);
|
|
4325
|
+
matrix = leaf.__world;
|
|
4004
4326
|
break;
|
|
4005
4327
|
case 'local':
|
|
4006
4328
|
point = leaf.getLocalPointByInner(bounds);
|
|
@@ -4010,12 +4332,14 @@ class LeafLayout {
|
|
|
4010
4332
|
point = bounds;
|
|
4011
4333
|
matrix = MatrixHelper.defaultMatrix;
|
|
4012
4334
|
break;
|
|
4335
|
+
case 'page':
|
|
4336
|
+
relative = leaf.zoomLayer;
|
|
4013
4337
|
default:
|
|
4014
4338
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4015
|
-
matrix =
|
|
4339
|
+
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4016
4340
|
}
|
|
4017
4341
|
const layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4018
|
-
copy$
|
|
4342
|
+
copy$5(layoutBounds, bounds);
|
|
4019
4343
|
PointHelper.copy(layoutBounds, point);
|
|
4020
4344
|
if (unscale) {
|
|
4021
4345
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -4043,6 +4367,8 @@ class LeafLayout {
|
|
|
4043
4367
|
break;
|
|
4044
4368
|
case 'inner':
|
|
4045
4369
|
break;
|
|
4370
|
+
case 'page':
|
|
4371
|
+
relative = leaf.zoomLayer;
|
|
4046
4372
|
default:
|
|
4047
4373
|
relativeLeaf = relative;
|
|
4048
4374
|
}
|
|
@@ -4382,359 +4708,87 @@ class RenderEvent extends Event {
|
|
|
4382
4708
|
this.times = times;
|
|
4383
4709
|
if (bounds) {
|
|
4384
4710
|
this.renderBounds = bounds;
|
|
4385
|
-
this.renderOptions = options;
|
|
4386
|
-
}
|
|
4387
|
-
}
|
|
4388
|
-
}
|
|
4389
|
-
RenderEvent.REQUEST = 'render.request';
|
|
4390
|
-
RenderEvent.START = 'render.start';
|
|
4391
|
-
RenderEvent.BEFORE = 'render.before';
|
|
4392
|
-
RenderEvent.RENDER = 'render';
|
|
4393
|
-
RenderEvent.AFTER = 'render.after';
|
|
4394
|
-
RenderEvent.AGAIN = 'render.again';
|
|
4395
|
-
RenderEvent.END = 'render.end';
|
|
4396
|
-
RenderEvent.NEXT = 'render.next';
|
|
4397
|
-
|
|
4398
|
-
class LeaferEvent extends Event {
|
|
4399
|
-
}
|
|
4400
|
-
LeaferEvent.START = 'leafer.start';
|
|
4401
|
-
LeaferEvent.BEFORE_READY = 'leafer.before_ready';
|
|
4402
|
-
LeaferEvent.READY = 'leafer.ready';
|
|
4403
|
-
LeaferEvent.AFTER_READY = 'leafer.after_ready';
|
|
4404
|
-
LeaferEvent.VIEW_READY = 'leafer.view_ready';
|
|
4405
|
-
LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
|
|
4406
|
-
LeaferEvent.STOP = 'leafer.stop';
|
|
4407
|
-
LeaferEvent.RESTART = 'leafer.restart';
|
|
4408
|
-
LeaferEvent.END = 'leafer.end';
|
|
4409
|
-
|
|
4410
|
-
const LeafDataProxy = {
|
|
4411
|
-
__setAttr(name, newValue) {
|
|
4412
|
-
if (this.leafer && this.leafer.created) {
|
|
4413
|
-
const oldValue = this.__.__getInput(name);
|
|
4414
|
-
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4415
|
-
this.__[name] = newValue;
|
|
4416
|
-
if (this.__proxyData)
|
|
4417
|
-
this.setProxyAttr(name, newValue);
|
|
4418
|
-
const { CHANGE } = PropertyEvent;
|
|
4419
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4420
|
-
if (this.isLeafer) {
|
|
4421
|
-
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
4422
|
-
}
|
|
4423
|
-
else {
|
|
4424
|
-
if (this.hasEvent(CHANGE))
|
|
4425
|
-
this.emitEvent(event);
|
|
4426
|
-
}
|
|
4427
|
-
this.leafer.emitEvent(event);
|
|
4428
|
-
}
|
|
4429
|
-
}
|
|
4430
|
-
else {
|
|
4431
|
-
this.__[name] = newValue;
|
|
4432
|
-
if (this.__proxyData)
|
|
4433
|
-
this.setProxyAttr(name, newValue);
|
|
4434
|
-
}
|
|
4435
|
-
},
|
|
4436
|
-
__getAttr(name) {
|
|
4437
|
-
if (this.__proxyData)
|
|
4438
|
-
return this.getProxyAttr(name);
|
|
4439
|
-
return this.__.__get(name);
|
|
4440
|
-
}
|
|
4441
|
-
};
|
|
4442
|
-
|
|
4443
|
-
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
4444
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4445
|
-
const LeafMatrix = {
|
|
4446
|
-
__updateWorldMatrix() {
|
|
4447
|
-
multiplyParent$2(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4448
|
-
},
|
|
4449
|
-
__updateLocalMatrix() {
|
|
4450
|
-
if (this.__local) {
|
|
4451
|
-
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4452
|
-
if (layout.affectScaleOrRotation) {
|
|
4453
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4454
|
-
setLayout(local, data, null, layout.affectRotation);
|
|
4455
|
-
layout.scaleChanged = layout.rotationChanged = false;
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
|
-
local.e = data.x;
|
|
4459
|
-
local.f = data.y;
|
|
4460
|
-
if (data.around) {
|
|
4461
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4462
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4463
|
-
}
|
|
4464
|
-
}
|
|
4465
|
-
this.__layout.matrixChanged = false;
|
|
4466
|
-
}
|
|
4467
|
-
};
|
|
4468
|
-
|
|
4469
|
-
const { copy: copy$5, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$1, divideParent, getLayout } = MatrixHelper;
|
|
4470
|
-
const matrix = {};
|
|
4471
|
-
const LeafHelper = {
|
|
4472
|
-
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4473
|
-
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
4474
|
-
waitAutoLayout = true;
|
|
4475
|
-
updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
|
|
4476
|
-
if (leaf.isBranch) {
|
|
4477
|
-
const { children } = leaf;
|
|
4478
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4479
|
-
updateAllMatrix$3(children[i], checkAutoLayout, waitAutoLayout);
|
|
4480
|
-
}
|
|
4481
|
-
}
|
|
4482
|
-
},
|
|
4483
|
-
updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4484
|
-
const layout = leaf.__layout;
|
|
4485
|
-
if (checkAutoLayout) {
|
|
4486
|
-
if (waitAutoLayout) {
|
|
4487
|
-
layout.waitAutoLayout = true;
|
|
4488
|
-
if (leaf.__hasAutoLayout)
|
|
4489
|
-
layout.matrixChanged = false;
|
|
4490
|
-
}
|
|
4491
|
-
}
|
|
4492
|
-
else if (layout.waitAutoLayout) {
|
|
4493
|
-
layout.waitAutoLayout = false;
|
|
4494
|
-
}
|
|
4495
|
-
if (layout.matrixChanged)
|
|
4496
|
-
leaf.__updateLocalMatrix();
|
|
4497
|
-
if (!layout.waitAutoLayout)
|
|
4498
|
-
leaf.__updateWorldMatrix();
|
|
4499
|
-
},
|
|
4500
|
-
updateBounds(leaf) {
|
|
4501
|
-
const layout = leaf.__layout;
|
|
4502
|
-
if (layout.boundsChanged)
|
|
4503
|
-
leaf.__updateLocalBounds();
|
|
4504
|
-
if (!layout.waitAutoLayout)
|
|
4505
|
-
leaf.__updateWorldBounds();
|
|
4506
|
-
},
|
|
4507
|
-
updateAllWorldOpacity(leaf) {
|
|
4508
|
-
leaf.__updateWorldOpacity();
|
|
4509
|
-
if (leaf.isBranch) {
|
|
4510
|
-
const { children } = leaf;
|
|
4511
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4512
|
-
updateAllWorldOpacity$1(children[i]);
|
|
4513
|
-
}
|
|
4514
|
-
}
|
|
4515
|
-
},
|
|
4516
|
-
updateAllChange(leaf) {
|
|
4517
|
-
updateAllWorldOpacity$1(leaf);
|
|
4518
|
-
leaf.__updateChange();
|
|
4519
|
-
if (leaf.isBranch) {
|
|
4520
|
-
const { children } = leaf;
|
|
4521
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4522
|
-
updateAllChange$1(children[i]);
|
|
4523
|
-
}
|
|
4524
|
-
}
|
|
4525
|
-
},
|
|
4526
|
-
worldHittable(t) {
|
|
4527
|
-
while (t) {
|
|
4528
|
-
if (!t.__.hittable)
|
|
4529
|
-
return false;
|
|
4530
|
-
t = t.parent;
|
|
4531
|
-
}
|
|
4532
|
-
return true;
|
|
4533
|
-
},
|
|
4534
|
-
moveWorld(t, x, y) {
|
|
4535
|
-
const local = { x, y };
|
|
4536
|
-
if (t.parent)
|
|
4537
|
-
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
4538
|
-
L.moveLocal(t, local.x, local.y);
|
|
4539
|
-
},
|
|
4540
|
-
moveLocal(t, x, y = 0) {
|
|
4541
|
-
t.x += x;
|
|
4542
|
-
t.y += y;
|
|
4543
|
-
},
|
|
4544
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4545
|
-
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4546
|
-
},
|
|
4547
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4548
|
-
copy$5(matrix, t.__localMatrix);
|
|
4549
|
-
scaleOfOuter$3(matrix, origin, scaleX, scaleY);
|
|
4550
|
-
moveByMatrix(t, matrix);
|
|
4551
|
-
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4552
|
-
},
|
|
4553
|
-
rotateOfWorld(t, origin, angle) {
|
|
4554
|
-
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4555
|
-
},
|
|
4556
|
-
rotateOfLocal(t, origin, angle) {
|
|
4557
|
-
copy$5(matrix, t.__localMatrix);
|
|
4558
|
-
rotateOfOuter$3(matrix, origin, angle);
|
|
4559
|
-
moveByMatrix(t, matrix);
|
|
4560
|
-
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4561
|
-
},
|
|
4562
|
-
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4563
|
-
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4564
|
-
},
|
|
4565
|
-
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4566
|
-
copy$5(matrix, t.__localMatrix);
|
|
4567
|
-
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4568
|
-
L.setTransform(t, matrix, resize);
|
|
4569
|
-
},
|
|
4570
|
-
transformWorld(t, transform, resize) {
|
|
4571
|
-
copy$5(matrix, t.worldTransform);
|
|
4572
|
-
multiplyParent$1(matrix, transform);
|
|
4573
|
-
if (t.parent)
|
|
4574
|
-
divideParent(matrix, t.parent.worldTransform);
|
|
4575
|
-
L.setTransform(t, matrix, resize);
|
|
4576
|
-
},
|
|
4577
|
-
transform(t, transform, resize) {
|
|
4578
|
-
copy$5(matrix, t.localTransform);
|
|
4579
|
-
multiplyParent$1(matrix, transform);
|
|
4580
|
-
L.setTransform(t, matrix, resize);
|
|
4581
|
-
},
|
|
4582
|
-
setTransform(t, transform, resize) {
|
|
4583
|
-
const layout = getLayout(transform);
|
|
4584
|
-
if (resize) {
|
|
4585
|
-
t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
|
|
4586
|
-
delete layout.scaleX;
|
|
4587
|
-
delete layout.scaleY;
|
|
4588
|
-
}
|
|
4589
|
-
t.set(layout);
|
|
4590
|
-
},
|
|
4591
|
-
drop(t, parent, index, resize) {
|
|
4592
|
-
copy$5(matrix, t.worldTransform);
|
|
4593
|
-
divideParent(matrix, parent.worldTransform);
|
|
4594
|
-
t.setTransform(matrix, resize);
|
|
4595
|
-
parent.add(t, index);
|
|
4596
|
-
},
|
|
4597
|
-
hasParent(p, parent) {
|
|
4598
|
-
if (!parent)
|
|
4599
|
-
return false;
|
|
4600
|
-
while (p) {
|
|
4601
|
-
if (parent === p)
|
|
4602
|
-
return true;
|
|
4603
|
-
p = p.parent;
|
|
4604
|
-
}
|
|
4605
|
-
},
|
|
4606
|
-
hasParentAutoLayout(p) {
|
|
4607
|
-
while (p.parent) {
|
|
4608
|
-
p = p.parent;
|
|
4609
|
-
if (p.__hasAutoLayout)
|
|
4610
|
-
return true;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
};
|
|
4614
|
-
const L = LeafHelper;
|
|
4615
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
|
|
4616
|
-
function moveByMatrix(t, matrix) {
|
|
4617
|
-
const { e, f } = t.__localMatrix;
|
|
4618
|
-
t.x += matrix.e - e;
|
|
4619
|
-
t.y += matrix.f - f;
|
|
4620
|
-
}
|
|
4621
|
-
function getTempLocal(t, world) {
|
|
4622
|
-
t.__layout.update();
|
|
4623
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4624
|
-
}
|
|
4625
|
-
|
|
4626
|
-
const LeafBoundsHelper = {
|
|
4627
|
-
worldBounds(target) {
|
|
4628
|
-
return target.__world;
|
|
4629
|
-
},
|
|
4630
|
-
localBoxBounds(target) {
|
|
4631
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4632
|
-
},
|
|
4633
|
-
localStrokeBounds(target) {
|
|
4634
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4635
|
-
},
|
|
4636
|
-
localRenderBounds(target) {
|
|
4637
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4638
|
-
},
|
|
4639
|
-
maskLocalBoxBounds(target) {
|
|
4640
|
-
return target.__.mask ? target.__localBoxBounds : null;
|
|
4641
|
-
},
|
|
4642
|
-
maskLocalStrokeBounds(target) {
|
|
4643
|
-
return target.__.mask ? target.__layout.localStrokeBounds : null;
|
|
4644
|
-
},
|
|
4645
|
-
maskLocalRenderBounds(target) {
|
|
4646
|
-
return target.__.mask ? target.__layout.localRenderBounds : null;
|
|
4647
|
-
},
|
|
4648
|
-
excludeRenderBounds(child, options) {
|
|
4649
|
-
if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
|
|
4650
|
-
return true;
|
|
4651
|
-
if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
|
|
4652
|
-
return true;
|
|
4653
|
-
return false;
|
|
4711
|
+
this.renderOptions = options;
|
|
4712
|
+
}
|
|
4654
4713
|
}
|
|
4655
|
-
}
|
|
4714
|
+
}
|
|
4715
|
+
RenderEvent.REQUEST = 'render.request';
|
|
4716
|
+
RenderEvent.START = 'render.start';
|
|
4717
|
+
RenderEvent.BEFORE = 'render.before';
|
|
4718
|
+
RenderEvent.RENDER = 'render';
|
|
4719
|
+
RenderEvent.AFTER = 'render.after';
|
|
4720
|
+
RenderEvent.AGAIN = 'render.again';
|
|
4721
|
+
RenderEvent.END = 'render.end';
|
|
4722
|
+
RenderEvent.NEXT = 'render.next';
|
|
4656
4723
|
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
leafList.add(leaf.parent);
|
|
4682
|
-
leaf = leaf.parent;
|
|
4724
|
+
class LeaferEvent extends Event {
|
|
4725
|
+
}
|
|
4726
|
+
LeaferEvent.START = 'leafer.start';
|
|
4727
|
+
LeaferEvent.BEFORE_READY = 'leafer.before_ready';
|
|
4728
|
+
LeaferEvent.READY = 'leafer.ready';
|
|
4729
|
+
LeaferEvent.AFTER_READY = 'leafer.after_ready';
|
|
4730
|
+
LeaferEvent.VIEW_READY = 'leafer.view_ready';
|
|
4731
|
+
LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
|
|
4732
|
+
LeaferEvent.STOP = 'leafer.stop';
|
|
4733
|
+
LeaferEvent.RESTART = 'leafer.restart';
|
|
4734
|
+
LeaferEvent.END = 'leafer.end';
|
|
4735
|
+
|
|
4736
|
+
const LeafDataProxy = {
|
|
4737
|
+
__setAttr(name, newValue) {
|
|
4738
|
+
if (this.leafer && this.leafer.created) {
|
|
4739
|
+
const oldValue = this.__.__getInput(name);
|
|
4740
|
+
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4741
|
+
this.__[name] = newValue;
|
|
4742
|
+
if (this.__proxyData)
|
|
4743
|
+
this.setProxyAttr(name, newValue);
|
|
4744
|
+
const { CHANGE } = PropertyEvent;
|
|
4745
|
+
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4746
|
+
if (this.isLeafer) {
|
|
4747
|
+
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
4683
4748
|
}
|
|
4684
4749
|
else {
|
|
4685
|
-
|
|
4750
|
+
if (this.hasEvent(CHANGE))
|
|
4751
|
+
this.emitEvent(event);
|
|
4686
4752
|
}
|
|
4753
|
+
this.leafer.emitEvent(event);
|
|
4687
4754
|
}
|
|
4688
4755
|
}
|
|
4689
4756
|
else {
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
}
|
|
4694
|
-
}
|
|
4695
|
-
},
|
|
4696
|
-
pushAllBranchStack(branch, pushList) {
|
|
4697
|
-
let start = pushList.length;
|
|
4698
|
-
const { children } = branch;
|
|
4699
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4700
|
-
if (children[i].isBranch) {
|
|
4701
|
-
pushList.push(children[i]);
|
|
4702
|
-
}
|
|
4703
|
-
}
|
|
4704
|
-
for (let i = start, len = pushList.length; i < len; i++) {
|
|
4705
|
-
pushAllBranchStack(pushList[i], pushList);
|
|
4757
|
+
this.__[name] = newValue;
|
|
4758
|
+
if (this.__proxyData)
|
|
4759
|
+
this.setProxyAttr(name, newValue);
|
|
4706
4760
|
}
|
|
4707
4761
|
},
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
},
|
|
4713
|
-
updateBoundsByBranchStack(branchStack, exclude) {
|
|
4714
|
-
let branch, children;
|
|
4715
|
-
for (let i = branchStack.length - 1; i > -1; i--) {
|
|
4716
|
-
branch = branchStack[i];
|
|
4717
|
-
children = branch.children;
|
|
4718
|
-
for (let j = 0, len = children.length; j < len; j++) {
|
|
4719
|
-
updateBounds$2(children[j]);
|
|
4720
|
-
}
|
|
4721
|
-
if (exclude && exclude === branch)
|
|
4722
|
-
continue;
|
|
4723
|
-
updateBounds$2(branch);
|
|
4724
|
-
}
|
|
4762
|
+
__getAttr(name) {
|
|
4763
|
+
if (this.__proxyData)
|
|
4764
|
+
return this.getProxyAttr(name);
|
|
4765
|
+
return this.__.__get(name);
|
|
4725
4766
|
}
|
|
4726
4767
|
};
|
|
4727
|
-
const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
|
|
4728
4768
|
|
|
4729
|
-
const
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4769
|
+
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4770
|
+
const { toPoint, tempPoint } = AroundHelper;
|
|
4771
|
+
const LeafMatrix = {
|
|
4772
|
+
__updateWorldMatrix() {
|
|
4773
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4774
|
+
},
|
|
4775
|
+
__updateLocalMatrix() {
|
|
4776
|
+
if (this.__local) {
|
|
4777
|
+
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4778
|
+
if (layout.affectScaleOrRotation) {
|
|
4779
|
+
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4780
|
+
setLayout(local, data, null, layout.affectRotation);
|
|
4781
|
+
layout.scaleChanged = layout.rotationChanged = false;
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
local.e = data.x;
|
|
4785
|
+
local.f = data.y;
|
|
4786
|
+
if (data.around) {
|
|
4787
|
+
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4788
|
+
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4735
4789
|
}
|
|
4736
|
-
wait.length === len ? wait.length = 0 : wait.splice(0, len);
|
|
4737
4790
|
}
|
|
4791
|
+
this.__layout.matrixChanged = false;
|
|
4738
4792
|
}
|
|
4739
4793
|
};
|
|
4740
4794
|
|
|
@@ -4951,7 +5005,7 @@ const { LEAF, create } = IncrementId;
|
|
|
4951
5005
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
4952
5006
|
const { toOuterOf } = BoundsHelper;
|
|
4953
5007
|
const { tempToOuterOf, copy: copy$4 } = PointHelper;
|
|
4954
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, transform, setTransform, drop } = LeafHelper;
|
|
5008
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getRelativeWorld, drop } = LeafHelper;
|
|
4955
5009
|
let Leaf = class Leaf {
|
|
4956
5010
|
get tag() { return this.__tag; }
|
|
4957
5011
|
set tag(_value) { }
|
|
@@ -4989,21 +5043,31 @@ let Leaf = class Leaf {
|
|
|
4989
5043
|
this.__layout = new this.__LayoutProcessor(this);
|
|
4990
5044
|
if (this.__level)
|
|
4991
5045
|
this.resetCustom();
|
|
4992
|
-
if (data)
|
|
5046
|
+
if (data) {
|
|
5047
|
+
if (data.__)
|
|
5048
|
+
data = data.toJSON();
|
|
4993
5049
|
data.children ? this.set(data) : Object.assign(this, data);
|
|
5050
|
+
}
|
|
4994
5051
|
}
|
|
4995
5052
|
resetCustom() {
|
|
4996
5053
|
this.__hasMask = this.__hasEraser = null;
|
|
4997
5054
|
this.forceUpdate();
|
|
4998
5055
|
}
|
|
4999
|
-
waitParent(item) {
|
|
5056
|
+
waitParent(item, bind) {
|
|
5057
|
+
if (bind)
|
|
5058
|
+
item = item.bind(bind);
|
|
5000
5059
|
this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
|
|
5001
5060
|
}
|
|
5002
|
-
waitLeafer(item) {
|
|
5061
|
+
waitLeafer(item, bind) {
|
|
5062
|
+
if (bind)
|
|
5063
|
+
item = item.bind(bind);
|
|
5003
5064
|
this.leafer ? item() : (this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item]);
|
|
5004
5065
|
}
|
|
5005
|
-
nextRender(item, off) {
|
|
5006
|
-
this.leafer ? this.leafer.nextRender(item, off) : this.waitLeafer(() => this.leafer.nextRender(item, off));
|
|
5066
|
+
nextRender(item, bind, off) {
|
|
5067
|
+
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
5068
|
+
}
|
|
5069
|
+
removeNextRender(item) {
|
|
5070
|
+
this.nextRender(item, null, 'off');
|
|
5007
5071
|
}
|
|
5008
5072
|
__bindLeafer(leafer) {
|
|
5009
5073
|
if (this.isLeafer) {
|
|
@@ -5040,6 +5104,7 @@ let Leaf = class Leaf {
|
|
|
5040
5104
|
getProxyAttr(_attrName) { return undefined; }
|
|
5041
5105
|
find(_condition, _options) { return undefined; }
|
|
5042
5106
|
findOne(_condition, _options) { return undefined; }
|
|
5107
|
+
focus(_value) { }
|
|
5043
5108
|
forceUpdate(attrName) {
|
|
5044
5109
|
if (attrName === undefined)
|
|
5045
5110
|
attrName = 'width';
|
|
@@ -5095,6 +5160,9 @@ let Leaf = class Leaf {
|
|
|
5095
5160
|
return this.__world.f;
|
|
5096
5161
|
return this.getLayoutBounds()[attrName];
|
|
5097
5162
|
}
|
|
5163
|
+
getTransform(relative) {
|
|
5164
|
+
return this.__layout.getTransform(relative || 'local');
|
|
5165
|
+
}
|
|
5098
5166
|
getBounds(type, relative) {
|
|
5099
5167
|
return this.__layout.getBounds(type, relative);
|
|
5100
5168
|
}
|
|
@@ -5104,6 +5172,12 @@ let Leaf = class Leaf {
|
|
|
5104
5172
|
getLayoutPoints(type, relative) {
|
|
5105
5173
|
return this.__layout.getLayoutPoints(type, relative);
|
|
5106
5174
|
}
|
|
5175
|
+
getWorldBounds(inner, relative, change) {
|
|
5176
|
+
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
5177
|
+
const to = change ? inner : {};
|
|
5178
|
+
toOuterOf(inner, matrix, to);
|
|
5179
|
+
return to;
|
|
5180
|
+
}
|
|
5107
5181
|
worldToLocal(world, to, distance, relative) {
|
|
5108
5182
|
if (this.parent) {
|
|
5109
5183
|
this.parent.worldToInner(world, to, distance, relative);
|
|
@@ -5186,6 +5260,21 @@ let Leaf = class Leaf {
|
|
|
5186
5260
|
skewOf(origin, skewX, skewY, resize) {
|
|
5187
5261
|
skewOfLocal(this, tempToOuterOf(origin, this.localTransform), skewX, skewY, resize);
|
|
5188
5262
|
}
|
|
5263
|
+
transformWorld(worldTransform, resize) {
|
|
5264
|
+
transformWorld(this, worldTransform, resize);
|
|
5265
|
+
}
|
|
5266
|
+
moveWorld(x, y) {
|
|
5267
|
+
moveWorld(this, x, y);
|
|
5268
|
+
}
|
|
5269
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
|
|
5270
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
|
|
5271
|
+
}
|
|
5272
|
+
rotateOfWorld(worldOrigin, rotation) {
|
|
5273
|
+
rotateOfWorld(this, worldOrigin, rotation);
|
|
5274
|
+
}
|
|
5275
|
+
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5276
|
+
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5277
|
+
}
|
|
5189
5278
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5190
5279
|
this.scaleX *= scaleX;
|
|
5191
5280
|
this.scaleY *= scaleY;
|
|
@@ -5317,7 +5406,8 @@ let Branch = class Branch extends Leaf {
|
|
|
5317
5406
|
index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5318
5407
|
if (child.isBranch)
|
|
5319
5408
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5320
|
-
child.__layout.
|
|
5409
|
+
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5410
|
+
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5321
5411
|
if (child.__parentWait)
|
|
5322
5412
|
WaitHelper.run(child.__parentWait);
|
|
5323
5413
|
if (this.leafer) {
|
|
@@ -6177,6 +6267,10 @@ class Renderer {
|
|
|
6177
6267
|
}
|
|
6178
6268
|
else {
|
|
6179
6269
|
this.requestLayout();
|
|
6270
|
+
if (this.ignore) {
|
|
6271
|
+
this.ignore = this.rendering = false;
|
|
6272
|
+
return;
|
|
6273
|
+
}
|
|
6180
6274
|
this.emitRender(RenderEvent.BEFORE);
|
|
6181
6275
|
if (this.config.usePartRender && this.totalTimes > 1) {
|
|
6182
6276
|
this.partRender();
|
|
@@ -6324,9 +6418,7 @@ class Renderer {
|
|
|
6324
6418
|
if (this.target) {
|
|
6325
6419
|
this.stop();
|
|
6326
6420
|
this.__removeListenEvents();
|
|
6327
|
-
this.target = null;
|
|
6328
|
-
this.canvas = null;
|
|
6329
|
-
this.config = null;
|
|
6421
|
+
this.target = this.canvas = this.config = null;
|
|
6330
6422
|
}
|
|
6331
6423
|
}
|
|
6332
6424
|
}
|
|
@@ -6583,14 +6675,36 @@ Object.assign(Creator, {
|
|
|
6583
6675
|
});
|
|
6584
6676
|
Platform.layout = Layouter.fullLayout;
|
|
6585
6677
|
|
|
6678
|
+
const TextConvert = {};
|
|
6679
|
+
const ColorConvert = {};
|
|
6680
|
+
const PathArrow = {};
|
|
6681
|
+
const Paint = {};
|
|
6682
|
+
const PaintImage = {};
|
|
6683
|
+
const PaintGradient = {};
|
|
6684
|
+
const Effect = {};
|
|
6685
|
+
const Export = {};
|
|
6686
|
+
const State = {};
|
|
6687
|
+
|
|
6688
|
+
function stateType(defaultValue) {
|
|
6689
|
+
return (target, key) => {
|
|
6690
|
+
const stateType = key + 'Style';
|
|
6691
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
6692
|
+
set(value) {
|
|
6693
|
+
this.__setAttr(key, value);
|
|
6694
|
+
this.waitLeafer(() => { if (State.setStyle)
|
|
6695
|
+
State.setStyle(this, stateType, value); });
|
|
6696
|
+
}
|
|
6697
|
+
});
|
|
6698
|
+
};
|
|
6699
|
+
}
|
|
6586
6700
|
function arrowType(defaultValue) {
|
|
6587
6701
|
return (target, key) => {
|
|
6588
6702
|
defineLeafAttr(target, key, defaultValue, {
|
|
6589
6703
|
set(value) {
|
|
6590
6704
|
this.__setAttr(key, value);
|
|
6591
|
-
doStrokeType(this);
|
|
6592
6705
|
const data = this.__;
|
|
6593
6706
|
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6707
|
+
doStrokeType(this);
|
|
6594
6708
|
}
|
|
6595
6709
|
});
|
|
6596
6710
|
};
|
|
@@ -6618,15 +6732,16 @@ function resizeType(defaultValue) {
|
|
|
6618
6732
|
});
|
|
6619
6733
|
};
|
|
6620
6734
|
}
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
const
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6735
|
+
function zoomLayerType() {
|
|
6736
|
+
return (target, key) => {
|
|
6737
|
+
const privateKey = '_' + key;
|
|
6738
|
+
defineKey(target, key, {
|
|
6739
|
+
set(value) { if (this.isLeafer)
|
|
6740
|
+
this[privateKey] = value; },
|
|
6741
|
+
get() { return this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer; }
|
|
6742
|
+
});
|
|
6743
|
+
};
|
|
6744
|
+
}
|
|
6630
6745
|
|
|
6631
6746
|
const { parse } = PathConvert;
|
|
6632
6747
|
const emptyPaint = {};
|
|
@@ -6635,7 +6750,7 @@ class UIData extends LeafData {
|
|
|
6635
6750
|
get __strokeWidth() {
|
|
6636
6751
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6637
6752
|
if (strokeWidthFixed) {
|
|
6638
|
-
let { scaleX } = this.__leaf.
|
|
6753
|
+
let { scaleX } = this.__leaf.__nowWorld;
|
|
6639
6754
|
if (scaleX < 0)
|
|
6640
6755
|
scaleX = -scaleX;
|
|
6641
6756
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
@@ -6909,18 +7024,11 @@ const UIRender = {
|
|
|
6909
7024
|
}
|
|
6910
7025
|
},
|
|
6911
7026
|
__drawFast(canvas, options) {
|
|
6912
|
-
|
|
6913
|
-
this.__drawRenderPath(canvas);
|
|
6914
|
-
if (fill)
|
|
6915
|
-
Paint.fill(fill, this, canvas);
|
|
6916
|
-
if (__drawAfterFill)
|
|
6917
|
-
this.__drawAfterFill(canvas, options);
|
|
6918
|
-
if (stroke)
|
|
6919
|
-
Paint.stroke(stroke, this, canvas);
|
|
7027
|
+
drawFast(this, canvas, options);
|
|
6920
7028
|
},
|
|
6921
7029
|
__draw(canvas, options) {
|
|
6922
|
-
|
|
6923
|
-
|
|
7030
|
+
const data = this.__;
|
|
7031
|
+
if (data.__complex) {
|
|
6924
7032
|
if (data.__needComputePaint)
|
|
6925
7033
|
data.__computePaint();
|
|
6926
7034
|
const { fill, stroke, __drawAfterFill } = data;
|
|
@@ -6953,7 +7061,12 @@ const UIRender = {
|
|
|
6953
7061
|
}
|
|
6954
7062
|
}
|
|
6955
7063
|
else {
|
|
6956
|
-
|
|
7064
|
+
if (data.__pathInputed) {
|
|
7065
|
+
drawFast(this, canvas, options);
|
|
7066
|
+
}
|
|
7067
|
+
else {
|
|
7068
|
+
this.__drawFast(canvas, options);
|
|
7069
|
+
}
|
|
6957
7070
|
}
|
|
6958
7071
|
},
|
|
6959
7072
|
__renderShape(canvas, options) {
|
|
@@ -6968,6 +7081,16 @@ const UIRender = {
|
|
|
6968
7081
|
}
|
|
6969
7082
|
}
|
|
6970
7083
|
};
|
|
7084
|
+
function drawFast(ui, canvas, options) {
|
|
7085
|
+
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7086
|
+
ui.__drawRenderPath(canvas);
|
|
7087
|
+
if (fill)
|
|
7088
|
+
Paint.fill(fill, ui, canvas);
|
|
7089
|
+
if (__drawAfterFill)
|
|
7090
|
+
ui.__drawAfterFill(canvas, options);
|
|
7091
|
+
if (stroke)
|
|
7092
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7093
|
+
}
|
|
6971
7094
|
|
|
6972
7095
|
const RectRender = {
|
|
6973
7096
|
__drawFast(canvas, options) {
|
|
@@ -7016,6 +7139,10 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7016
7139
|
const { scaleX, scaleY } = this;
|
|
7017
7140
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7018
7141
|
}
|
|
7142
|
+
get pen() {
|
|
7143
|
+
pen.set(this.path = this.__.path || []);
|
|
7144
|
+
return pen;
|
|
7145
|
+
}
|
|
7019
7146
|
constructor(data) {
|
|
7020
7147
|
super(data);
|
|
7021
7148
|
}
|
|
@@ -7024,7 +7151,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7024
7151
|
Object.assign(this, data);
|
|
7025
7152
|
}
|
|
7026
7153
|
get(name) {
|
|
7027
|
-
return name ? this.__.__getInput(name) : this.__.__getInputData();
|
|
7154
|
+
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
7028
7155
|
}
|
|
7029
7156
|
createProxyData() { return undefined; }
|
|
7030
7157
|
find(_condition, _options) { return undefined; }
|
|
@@ -7033,10 +7160,11 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7033
7160
|
this.__layout.update();
|
|
7034
7161
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7035
7162
|
if (!path) {
|
|
7036
|
-
path = [];
|
|
7037
7163
|
const { width, height } = this.boxBounds;
|
|
7038
|
-
if (width || height)
|
|
7039
|
-
|
|
7164
|
+
if (width || height) {
|
|
7165
|
+
pen.set(path = []);
|
|
7166
|
+
this.__drawPathByBox(pen);
|
|
7167
|
+
}
|
|
7040
7168
|
}
|
|
7041
7169
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7042
7170
|
}
|
|
@@ -7108,6 +7236,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7108
7236
|
__decorate([
|
|
7109
7237
|
dataProcessor(UIData)
|
|
7110
7238
|
], UI.prototype, "__", void 0);
|
|
7239
|
+
__decorate([
|
|
7240
|
+
zoomLayerType()
|
|
7241
|
+
], UI.prototype, "zoomLayer", void 0);
|
|
7111
7242
|
__decorate([
|
|
7112
7243
|
dataType('')
|
|
7113
7244
|
], UI.prototype, "id", void 0);
|
|
@@ -7126,6 +7257,12 @@ __decorate([
|
|
|
7126
7257
|
__decorate([
|
|
7127
7258
|
opacityType(true)
|
|
7128
7259
|
], UI.prototype, "visible", void 0);
|
|
7260
|
+
__decorate([
|
|
7261
|
+
stateType(false)
|
|
7262
|
+
], UI.prototype, "selected", void 0);
|
|
7263
|
+
__decorate([
|
|
7264
|
+
stateType(false)
|
|
7265
|
+
], UI.prototype, "disabled", void 0);
|
|
7129
7266
|
__decorate([
|
|
7130
7267
|
dataType(false)
|
|
7131
7268
|
], UI.prototype, "locked", void 0);
|
|
@@ -7273,6 +7410,24 @@ __decorate([
|
|
|
7273
7410
|
__decorate([
|
|
7274
7411
|
effectType()
|
|
7275
7412
|
], UI.prototype, "grayscale", void 0);
|
|
7413
|
+
__decorate([
|
|
7414
|
+
dataType()
|
|
7415
|
+
], UI.prototype, "normalStyle", void 0);
|
|
7416
|
+
__decorate([
|
|
7417
|
+
dataType()
|
|
7418
|
+
], UI.prototype, "hoverStyle", void 0);
|
|
7419
|
+
__decorate([
|
|
7420
|
+
dataType()
|
|
7421
|
+
], UI.prototype, "pressStyle", void 0);
|
|
7422
|
+
__decorate([
|
|
7423
|
+
dataType()
|
|
7424
|
+
], UI.prototype, "focusStyle", void 0);
|
|
7425
|
+
__decorate([
|
|
7426
|
+
dataType()
|
|
7427
|
+
], UI.prototype, "selectedStyle", void 0);
|
|
7428
|
+
__decorate([
|
|
7429
|
+
dataType()
|
|
7430
|
+
], UI.prototype, "disabledStyle", void 0);
|
|
7276
7431
|
__decorate([
|
|
7277
7432
|
rewrite(Leaf.prototype.reset)
|
|
7278
7433
|
], UI.prototype, "reset", null);
|
|
@@ -7309,7 +7464,7 @@ let Group = class Group extends UI {
|
|
|
7309
7464
|
super.set(data);
|
|
7310
7465
|
let child;
|
|
7311
7466
|
children.forEach(childData => {
|
|
7312
|
-
child = UICreator.get(childData.tag, childData);
|
|
7467
|
+
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
7313
7468
|
this.add(child);
|
|
7314
7469
|
});
|
|
7315
7470
|
data.children = children;
|
|
@@ -7358,7 +7513,6 @@ let Leafer = class Leafer extends Group {
|
|
|
7358
7513
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7359
7514
|
constructor(userConfig, data) {
|
|
7360
7515
|
super(data);
|
|
7361
|
-
this.zoomLayer = this;
|
|
7362
7516
|
this.config = {
|
|
7363
7517
|
type: 'design',
|
|
7364
7518
|
start: true,
|
|
@@ -7371,7 +7525,6 @@ let Leafer = class Leafer extends Group {
|
|
|
7371
7525
|
move: {
|
|
7372
7526
|
holdSpaceKey: true,
|
|
7373
7527
|
holdMiddleKey: true,
|
|
7374
|
-
dragOut: true,
|
|
7375
7528
|
autoDistance: 2
|
|
7376
7529
|
}
|
|
7377
7530
|
};
|
|
@@ -7502,9 +7655,6 @@ let Leafer = class Leafer extends Group {
|
|
|
7502
7655
|
this.leafer = leafer;
|
|
7503
7656
|
this.__level = 1;
|
|
7504
7657
|
}
|
|
7505
|
-
setZoomLayer(zoomLayer) {
|
|
7506
|
-
this.zoomLayer = zoomLayer;
|
|
7507
|
-
}
|
|
7508
7658
|
__checkAutoLayout(config) {
|
|
7509
7659
|
if (!config.width || !config.height) {
|
|
7510
7660
|
this.autoLayout = new AutoBounds(config);
|
|
@@ -7590,13 +7740,19 @@ let Leafer = class Leafer extends Group {
|
|
|
7590
7740
|
this.nextRender(() => this.interaction.updateCursor());
|
|
7591
7741
|
}
|
|
7592
7742
|
}
|
|
7593
|
-
waitReady(item) {
|
|
7743
|
+
waitReady(item, bind) {
|
|
7744
|
+
if (bind)
|
|
7745
|
+
item = item.bind(bind);
|
|
7594
7746
|
this.ready ? item() : this.__readyWait.push(item);
|
|
7595
7747
|
}
|
|
7596
|
-
waitViewReady(item) {
|
|
7748
|
+
waitViewReady(item, bind) {
|
|
7749
|
+
if (bind)
|
|
7750
|
+
item = item.bind(bind);
|
|
7597
7751
|
this.viewReady ? item() : this.__viewReadyWait.push(item);
|
|
7598
7752
|
}
|
|
7599
|
-
waitViewCompleted(item) {
|
|
7753
|
+
waitViewCompleted(item, bind) {
|
|
7754
|
+
if (bind)
|
|
7755
|
+
item = item.bind(bind);
|
|
7600
7756
|
this.__viewCompletedWait.push(item);
|
|
7601
7757
|
if (this.viewCompleted) {
|
|
7602
7758
|
this.__checkViewCompleted(false);
|
|
@@ -7606,7 +7762,9 @@ let Leafer = class Leafer extends Group {
|
|
|
7606
7762
|
this.start();
|
|
7607
7763
|
}
|
|
7608
7764
|
}
|
|
7609
|
-
nextRender(item, off) {
|
|
7765
|
+
nextRender(item, bind, off) {
|
|
7766
|
+
if (bind)
|
|
7767
|
+
item = item.bind(bind);
|
|
7610
7768
|
const list = this.__nextRenderWait;
|
|
7611
7769
|
if (off) {
|
|
7612
7770
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -7620,6 +7778,15 @@ let Leafer = class Leafer extends Group {
|
|
|
7620
7778
|
list.push(item);
|
|
7621
7779
|
}
|
|
7622
7780
|
}
|
|
7781
|
+
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7782
|
+
validScale(changeScale) {
|
|
7783
|
+
const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
7784
|
+
if (absScale < min)
|
|
7785
|
+
changeScale = min / scaleX;
|
|
7786
|
+
else if (absScale > max)
|
|
7787
|
+
changeScale = max / scaleX;
|
|
7788
|
+
return changeScale;
|
|
7789
|
+
}
|
|
7623
7790
|
__checkUpdateLayout() {
|
|
7624
7791
|
this.__layout.update();
|
|
7625
7792
|
}
|
|
@@ -8692,17 +8859,21 @@ KeyEvent = __decorate([
|
|
|
8692
8859
|
function design(leafer) {
|
|
8693
8860
|
if (leafer.isApp)
|
|
8694
8861
|
return;
|
|
8695
|
-
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) =>
|
|
8862
|
+
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
|
|
8863
|
+
let { moveX, moveY } = e;
|
|
8864
|
+
if (leafer.config.move.scroll) {
|
|
8865
|
+
if (Math.abs(moveX) > Math.abs(moveY))
|
|
8866
|
+
moveY = 0;
|
|
8867
|
+
else
|
|
8868
|
+
moveX = 0;
|
|
8869
|
+
}
|
|
8870
|
+
leafer.zoomLayer.move(moveX, moveY);
|
|
8871
|
+
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
|
|
8696
8872
|
const { zoomLayer } = leafer;
|
|
8697
|
-
const
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
scale =
|
|
8701
|
-
else if (absScale > max)
|
|
8702
|
-
scale = max / scaleX;
|
|
8703
|
-
if (scale !== 1) {
|
|
8704
|
-
PointHelper.scaleOf(zoomLayer, e, scale);
|
|
8705
|
-
zoomLayer.scale = scaleX * scale;
|
|
8873
|
+
const changeScale = leafer.validScale(e.scale);
|
|
8874
|
+
if (changeScale !== 1) {
|
|
8875
|
+
PointHelper.scaleOf(zoomLayer, e, changeScale);
|
|
8876
|
+
zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
|
|
8706
8877
|
}
|
|
8707
8878
|
}));
|
|
8708
8879
|
}
|
|
@@ -8746,6 +8917,7 @@ class Transformer {
|
|
|
8746
8917
|
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
8747
8918
|
data.path = path;
|
|
8748
8919
|
this.moveData = Object.assign(Object.assign({}, data), { moveX: 0, moveY: 0 });
|
|
8920
|
+
interaction.cancelHover();
|
|
8749
8921
|
interaction.emit(MoveEvent.START, this.moveData);
|
|
8750
8922
|
}
|
|
8751
8923
|
data.path = this.moveData.path;
|
|
@@ -8759,6 +8931,7 @@ class Transformer {
|
|
|
8759
8931
|
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
8760
8932
|
data.path = path;
|
|
8761
8933
|
this.zoomData = Object.assign(Object.assign({}, data), { scale: 1 });
|
|
8934
|
+
interaction.cancelHover();
|
|
8762
8935
|
interaction.emit(ZoomEvent.START, this.zoomData);
|
|
8763
8936
|
}
|
|
8764
8937
|
data.path = this.zoomData.path;
|
|
@@ -8772,6 +8945,7 @@ class Transformer {
|
|
|
8772
8945
|
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
8773
8946
|
data.path = path;
|
|
8774
8947
|
this.rotateData = Object.assign(Object.assign({}, data), { rotation: 0 });
|
|
8948
|
+
interaction.cancelHover();
|
|
8775
8949
|
interaction.emit(RotateEvent.START, this.rotateData);
|
|
8776
8950
|
}
|
|
8777
8951
|
data.path = this.rotateData.path;
|
|
@@ -8889,6 +9063,7 @@ class Dragger {
|
|
|
8889
9063
|
this.dragEndReal();
|
|
8890
9064
|
this.downData = this.interaction.downData;
|
|
8891
9065
|
this.dragData = getDragEventData(data, data, data);
|
|
9066
|
+
this.canAnimate = this.canDragOut = true;
|
|
8892
9067
|
}
|
|
8893
9068
|
getList() {
|
|
8894
9069
|
const { proxy } = this.interaction.selector;
|
|
@@ -8901,9 +9076,6 @@ class Dragger {
|
|
|
8901
9076
|
interaction.pointerCancel();
|
|
8902
9077
|
return;
|
|
8903
9078
|
}
|
|
8904
|
-
else {
|
|
8905
|
-
this.canAnimate = true;
|
|
8906
|
-
}
|
|
8907
9079
|
if (!this.moving && canDrag) {
|
|
8908
9080
|
if (this.moving = interaction.moveMode || interaction.isHoldRightKey)
|
|
8909
9081
|
interaction.emit(MoveEvent.START, this.dragData);
|
|
@@ -8954,13 +9126,14 @@ class Dragger {
|
|
|
8954
9126
|
const list = this.getList();
|
|
8955
9127
|
if (list.length && running) {
|
|
8956
9128
|
const { moveX, moveY } = this.dragData;
|
|
8957
|
-
list.forEach(leaf =>
|
|
9129
|
+
list.forEach(leaf => leaf.moveWorld(moveX, moveY));
|
|
8958
9130
|
}
|
|
8959
9131
|
}
|
|
8960
9132
|
dragOverOrOut(data) {
|
|
8961
9133
|
const { interaction } = this;
|
|
8962
9134
|
const { dragOverPath } = this;
|
|
8963
9135
|
const { path } = data;
|
|
9136
|
+
this.dragOverPath = path;
|
|
8964
9137
|
if (dragOverPath) {
|
|
8965
9138
|
if (path.indexAt(0) !== dragOverPath.indexAt(0)) {
|
|
8966
9139
|
interaction.emit(DragEvent.OUT, data, dragOverPath);
|
|
@@ -8970,7 +9143,6 @@ class Dragger {
|
|
|
8970
9143
|
else {
|
|
8971
9144
|
interaction.emit(DragEvent.OVER, data, path);
|
|
8972
9145
|
}
|
|
8973
|
-
this.dragOverPath = path;
|
|
8974
9146
|
}
|
|
8975
9147
|
dragEnterOrLeave(data) {
|
|
8976
9148
|
const { interaction } = this;
|
|
@@ -8984,7 +9156,7 @@ class Dragger {
|
|
|
8984
9156
|
if (!this.dragData)
|
|
8985
9157
|
return;
|
|
8986
9158
|
const { moveX, moveY } = this.dragData;
|
|
8987
|
-
if (this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
|
|
9159
|
+
if (this.interaction.config.move.dragAnimate && this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
|
|
8988
9160
|
data = Object.assign({}, data);
|
|
8989
9161
|
speed = (speed || (data.pointerType === 'touch' ? 2 : 1)) * 0.9;
|
|
8990
9162
|
PointHelper.move(data, moveX * speed, moveY * speed);
|
|
@@ -9018,12 +9190,11 @@ class Dragger {
|
|
|
9018
9190
|
animate(func, off) {
|
|
9019
9191
|
const animateWait = func || this.animateWait;
|
|
9020
9192
|
if (animateWait)
|
|
9021
|
-
this.interaction.target.nextRender(animateWait, off);
|
|
9193
|
+
this.interaction.target.nextRender(animateWait, null, off);
|
|
9022
9194
|
this.animateWait = func;
|
|
9023
9195
|
}
|
|
9024
9196
|
swipe(data, endDragData) {
|
|
9025
|
-
const { interaction } = this;
|
|
9026
|
-
const { downData } = interaction;
|
|
9197
|
+
const { interaction, downData } = this;
|
|
9027
9198
|
if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
|
|
9028
9199
|
const swipeData = getSwipeEventData(downData, this.dragData, endDragData);
|
|
9029
9200
|
this.interaction.emit(swipeData.type, swipeData);
|
|
@@ -9046,9 +9217,9 @@ class Dragger {
|
|
|
9046
9217
|
this.autoMoveOnDragOut(data);
|
|
9047
9218
|
}
|
|
9048
9219
|
autoMoveOnDragOut(data) {
|
|
9049
|
-
const { interaction, downData } = this;
|
|
9220
|
+
const { interaction, downData, canDragOut } = this;
|
|
9050
9221
|
const { autoDistance, dragOut } = interaction.config.move;
|
|
9051
|
-
if (!dragOut || !autoDistance)
|
|
9222
|
+
if (!dragOut || !canDragOut || !autoDistance)
|
|
9052
9223
|
return;
|
|
9053
9224
|
const bounds = interaction.shrinkCanvasBounds;
|
|
9054
9225
|
const { x, y } = bounds;
|
|
@@ -9124,12 +9295,16 @@ function emitAppChildren(leaf, type, data, capture, excludePath) {
|
|
|
9124
9295
|
function emitEvent(leaf, type, data, capture, excludePath) {
|
|
9125
9296
|
if (leaf.destroyed)
|
|
9126
9297
|
return true;
|
|
9127
|
-
if (leaf.__.hitSelf &&
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
leaf.
|
|
9131
|
-
|
|
9132
|
-
|
|
9298
|
+
if (leaf.__.hitSelf && !exclude(leaf, excludePath)) {
|
|
9299
|
+
if (State.updateEventStyle)
|
|
9300
|
+
State.updateEventStyle(leaf, type);
|
|
9301
|
+
if (leaf.hasEvent(type, capture)) {
|
|
9302
|
+
data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
|
|
9303
|
+
const event = EventCreator.get(type, data);
|
|
9304
|
+
leaf.emitEvent(event, capture);
|
|
9305
|
+
if (event.isStop)
|
|
9306
|
+
return true;
|
|
9307
|
+
}
|
|
9133
9308
|
}
|
|
9134
9309
|
return false;
|
|
9135
9310
|
}
|
|
@@ -9154,7 +9329,6 @@ const MultiTouchHelper = {
|
|
|
9154
9329
|
|
|
9155
9330
|
const config = {
|
|
9156
9331
|
wheel: {
|
|
9157
|
-
zoomMode: false,
|
|
9158
9332
|
zoomSpeed: 0.5,
|
|
9159
9333
|
moveSpeed: 0.5,
|
|
9160
9334
|
rotateSpeed: 0.5,
|
|
@@ -9163,14 +9337,12 @@ const config = {
|
|
|
9163
9337
|
},
|
|
9164
9338
|
pointer: {
|
|
9165
9339
|
hitRadius: 5,
|
|
9166
|
-
through: false,
|
|
9167
9340
|
tapTime: 120,
|
|
9168
9341
|
longPressTime: 800,
|
|
9169
9342
|
transformTime: 500,
|
|
9170
9343
|
dragHover: true,
|
|
9171
9344
|
dragDistance: 2,
|
|
9172
9345
|
swipeDistance: 20,
|
|
9173
|
-
ignoreMove: false,
|
|
9174
9346
|
preventDefaultMenu: true
|
|
9175
9347
|
},
|
|
9176
9348
|
cursor: {}
|
|
@@ -9213,17 +9385,19 @@ class InteractionBase {
|
|
|
9213
9385
|
this.updateDownData(data);
|
|
9214
9386
|
if (useDefaultPath)
|
|
9215
9387
|
data.path = this.defaultPath;
|
|
9216
|
-
this.emit(PointerEvent.BEFORE_DOWN, data);
|
|
9217
|
-
this.emit(PointerEvent.DOWN, data);
|
|
9218
9388
|
this.downTime = Date.now();
|
|
9219
|
-
this.
|
|
9220
|
-
|
|
9221
|
-
this.
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9389
|
+
if (this.downed = !this.moveMode) {
|
|
9390
|
+
this.emit(PointerEvent.BEFORE_DOWN, data);
|
|
9391
|
+
this.emit(PointerEvent.DOWN, data);
|
|
9392
|
+
if (PointerButton.left(data)) {
|
|
9393
|
+
this.tapWait();
|
|
9394
|
+
this.longPressWait(data);
|
|
9395
|
+
}
|
|
9396
|
+
else if (PointerButton.right(data)) {
|
|
9397
|
+
this.waitMenuTap = true;
|
|
9398
|
+
}
|
|
9226
9399
|
}
|
|
9400
|
+
this.dragger.setDragData(data);
|
|
9227
9401
|
this.updateCursor(data);
|
|
9228
9402
|
}
|
|
9229
9403
|
pointerMove(data) {
|
|
@@ -9231,14 +9405,18 @@ class InteractionBase {
|
|
|
9231
9405
|
data = this.hoverData;
|
|
9232
9406
|
if (!data)
|
|
9233
9407
|
return;
|
|
9234
|
-
|
|
9408
|
+
const { downData } = this;
|
|
9409
|
+
if (downData)
|
|
9235
9410
|
PointerButton.defaultLeft(data);
|
|
9236
9411
|
const hit = this.canvas.bounds.hitPoint(data);
|
|
9237
|
-
if (hit ||
|
|
9238
|
-
if (hit && !
|
|
9412
|
+
if (hit || downData) {
|
|
9413
|
+
if (hit && !downData && PointerButton.left(data)) {
|
|
9239
9414
|
this.pointerDown(data, true);
|
|
9415
|
+
this.dragger.canDragOut = false;
|
|
9416
|
+
}
|
|
9240
9417
|
this.pointerMoveReal(data);
|
|
9241
|
-
|
|
9418
|
+
if (downData)
|
|
9419
|
+
this.dragger.checkDragOut(data);
|
|
9242
9420
|
}
|
|
9243
9421
|
}
|
|
9244
9422
|
pointerMoveReal(data) {
|
|
@@ -9254,9 +9432,11 @@ class InteractionBase {
|
|
|
9254
9432
|
}
|
|
9255
9433
|
if (!this.dragger.moving) {
|
|
9256
9434
|
this.updateHoverData(data);
|
|
9435
|
+
if (this.moveMode)
|
|
9436
|
+
data.path = this.defaultPath;
|
|
9257
9437
|
this.emit(PointerEvent.MOVE, data);
|
|
9258
|
-
this.
|
|
9259
|
-
|
|
9438
|
+
if (!(this.dragging && !this.config.pointer.dragHover))
|
|
9439
|
+
this.pointerHover(data);
|
|
9260
9440
|
if (this.dragger.dragging) {
|
|
9261
9441
|
this.dragger.dragOverOrOut(data);
|
|
9262
9442
|
this.dragger.dragEnterOrLeave(data);
|
|
@@ -9265,20 +9445,24 @@ class InteractionBase {
|
|
|
9265
9445
|
this.updateCursor(this.downData || data);
|
|
9266
9446
|
}
|
|
9267
9447
|
pointerUp(data) {
|
|
9448
|
+
const { downData, oldDownData } = this;
|
|
9268
9449
|
if (!data)
|
|
9269
|
-
data =
|
|
9270
|
-
if (!
|
|
9450
|
+
data = downData;
|
|
9451
|
+
if (!downData)
|
|
9271
9452
|
return;
|
|
9272
9453
|
PointerButton.defaultLeft(data);
|
|
9273
9454
|
this.findPath(data);
|
|
9274
|
-
this.
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
this.emit(PointerEvent.UP,
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9455
|
+
if (this.downed) {
|
|
9456
|
+
this.downed = false;
|
|
9457
|
+
this.emit(PointerEvent.BEFORE_UP, data);
|
|
9458
|
+
this.emit(PointerEvent.UP, data);
|
|
9459
|
+
if (oldDownData)
|
|
9460
|
+
this.emit(PointerEvent.UP, oldDownData, undefined, data.path);
|
|
9461
|
+
this.emit(PointerEvent.UP, downData, undefined, data.path);
|
|
9462
|
+
this.touchLeave(data);
|
|
9463
|
+
this.tap(data);
|
|
9464
|
+
this.menuTap(data);
|
|
9465
|
+
}
|
|
9282
9466
|
this.dragger.dragEnd(data);
|
|
9283
9467
|
this.downData = this.oldDownData = null;
|
|
9284
9468
|
this.updateCursor(data);
|
|
@@ -9318,8 +9502,10 @@ class InteractionBase {
|
|
|
9318
9502
|
this.downKeyMap[code] = true;
|
|
9319
9503
|
Keyboard.setDownCode(code);
|
|
9320
9504
|
this.emit(KeyEvent.HOLD, data, this.defaultPath);
|
|
9321
|
-
if (this.moveMode)
|
|
9505
|
+
if (this.moveMode) {
|
|
9506
|
+
this.cancelHover();
|
|
9322
9507
|
this.updateCursor();
|
|
9508
|
+
}
|
|
9323
9509
|
}
|
|
9324
9510
|
this.emit(KeyEvent.DOWN, data, this.defaultPath);
|
|
9325
9511
|
}
|
|
@@ -9331,32 +9517,34 @@ class InteractionBase {
|
|
|
9331
9517
|
if (this.cursor === 'grab')
|
|
9332
9518
|
this.updateCursor();
|
|
9333
9519
|
}
|
|
9520
|
+
pointerHover(data) {
|
|
9521
|
+
this.pointerOverOrOut(data);
|
|
9522
|
+
this.pointerEnterOrLeave(data);
|
|
9523
|
+
}
|
|
9334
9524
|
pointerOverOrOut(data) {
|
|
9335
|
-
if (this.dragger.moving)
|
|
9336
|
-
return;
|
|
9337
|
-
if (this.dragging && !this.config.pointer.dragHover)
|
|
9338
|
-
return;
|
|
9339
9525
|
const { path } = data;
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9526
|
+
const { overPath } = this;
|
|
9527
|
+
this.overPath = path;
|
|
9528
|
+
if (overPath) {
|
|
9529
|
+
if (path.indexAt(0) !== overPath.indexAt(0)) {
|
|
9530
|
+
this.emit(PointerEvent.OUT, data, overPath);
|
|
9343
9531
|
this.emit(PointerEvent.OVER, data, path);
|
|
9344
9532
|
}
|
|
9345
9533
|
}
|
|
9346
9534
|
else {
|
|
9347
9535
|
this.emit(PointerEvent.OVER, data, path);
|
|
9348
9536
|
}
|
|
9349
|
-
this.overPath = path;
|
|
9350
9537
|
}
|
|
9351
9538
|
pointerEnterOrLeave(data) {
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
this.emit(PointerEvent.ENTER, data, path, this.enterPath);
|
|
9539
|
+
let { path } = data;
|
|
9540
|
+
if (this.downData && !this.moveMode) {
|
|
9541
|
+
path = path.clone();
|
|
9542
|
+
this.downData.path.forEach(leaf => path.add(leaf));
|
|
9543
|
+
}
|
|
9544
|
+
const { enterPath } = this;
|
|
9359
9545
|
this.enterPath = path;
|
|
9546
|
+
this.emit(PointerEvent.LEAVE, data, enterPath, path);
|
|
9547
|
+
this.emit(PointerEvent.ENTER, data, path, enterPath);
|
|
9360
9548
|
}
|
|
9361
9549
|
touchLeave(data) {
|
|
9362
9550
|
if (data.pointerType === 'touch') {
|
|
@@ -9412,6 +9600,23 @@ class InteractionBase {
|
|
|
9412
9600
|
isDrag(leaf) {
|
|
9413
9601
|
return this.dragger.getList().has(leaf);
|
|
9414
9602
|
}
|
|
9603
|
+
isPress(leaf) {
|
|
9604
|
+
const { downData, oldDownData } = this;
|
|
9605
|
+
return this.downed && ((downData && downData.path.has(leaf)) || (oldDownData && oldDownData.path.has(leaf)));
|
|
9606
|
+
}
|
|
9607
|
+
isHover(leaf) {
|
|
9608
|
+
return this.enterPath && this.enterPath.has(leaf);
|
|
9609
|
+
}
|
|
9610
|
+
isFocus(leaf) {
|
|
9611
|
+
return this.focusData === leaf;
|
|
9612
|
+
}
|
|
9613
|
+
cancelHover() {
|
|
9614
|
+
const { hoverData } = this;
|
|
9615
|
+
if (hoverData) {
|
|
9616
|
+
hoverData.path = this.defaultPath;
|
|
9617
|
+
this.pointerHover(hoverData);
|
|
9618
|
+
}
|
|
9619
|
+
}
|
|
9415
9620
|
updateDownData(data, options) {
|
|
9416
9621
|
const { downData } = this;
|
|
9417
9622
|
if (!data && downData)
|
|
@@ -9445,8 +9650,7 @@ class InteractionBase {
|
|
|
9445
9650
|
}
|
|
9446
9651
|
else if (!data)
|
|
9447
9652
|
return;
|
|
9448
|
-
let leaf;
|
|
9449
|
-
let cursor;
|
|
9653
|
+
let leaf, cursor;
|
|
9450
9654
|
const { path } = data;
|
|
9451
9655
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
9452
9656
|
leaf = path.list[i];
|
|
@@ -10390,10 +10594,6 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10390
10594
|
case 'strench':
|
|
10391
10595
|
if (!sameBox)
|
|
10392
10596
|
width = box.width, height = box.height;
|
|
10393
|
-
if (box.x || box.y) {
|
|
10394
|
-
data.transform = get$3();
|
|
10395
|
-
translate(data.transform, box.x, box.y);
|
|
10396
|
-
}
|
|
10397
10597
|
break;
|
|
10398
10598
|
case 'clip':
|
|
10399
10599
|
if (offset || scaleX || rotation)
|
|
@@ -10411,6 +10611,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10411
10611
|
if (!sameBox || rotation)
|
|
10412
10612
|
fillOrFitMode(data, mode, box, width, height, rotation);
|
|
10413
10613
|
}
|
|
10614
|
+
if (!data.transform) {
|
|
10615
|
+
if (box.x || box.y) {
|
|
10616
|
+
data.transform = get$3();
|
|
10617
|
+
translate(data.transform, box.x, box.y);
|
|
10618
|
+
}
|
|
10619
|
+
}
|
|
10414
10620
|
data.width = width;
|
|
10415
10621
|
data.height = height;
|
|
10416
10622
|
if (opacity)
|
|
@@ -10428,8 +10634,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10428
10634
|
leafPaint = cache.leafPaint;
|
|
10429
10635
|
}
|
|
10430
10636
|
else {
|
|
10431
|
-
leafPaint = { type: paint.type };
|
|
10432
|
-
leafPaint.image = image;
|
|
10637
|
+
leafPaint = { type: paint.type, image };
|
|
10433
10638
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
10434
10639
|
}
|
|
10435
10640
|
if (firstUse || image.loading)
|
|
@@ -10446,9 +10651,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10446
10651
|
onLoadError(ui, event, image.error);
|
|
10447
10652
|
}
|
|
10448
10653
|
else {
|
|
10654
|
+
ignoreRender(ui, true);
|
|
10449
10655
|
if (firstUse)
|
|
10450
10656
|
onLoad(ui, event);
|
|
10451
10657
|
leafPaint.loadId = image.load(() => {
|
|
10658
|
+
ignoreRender(ui, false);
|
|
10452
10659
|
if (!ui.destroyed) {
|
|
10453
10660
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
|
|
10454
10661
|
ui.forceUpdate('surface');
|
|
@@ -10456,6 +10663,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10456
10663
|
}
|
|
10457
10664
|
leafPaint.loadId = null;
|
|
10458
10665
|
}, (error) => {
|
|
10666
|
+
ignoreRender(ui, false);
|
|
10459
10667
|
onLoadError(ui, event, error);
|
|
10460
10668
|
leafPaint.loadId = null;
|
|
10461
10669
|
});
|
|
@@ -10495,11 +10703,16 @@ function emit(ui, type, data) {
|
|
|
10495
10703
|
if (ui.hasEvent(type))
|
|
10496
10704
|
ui.emitEvent(new ImageEvent(type, data));
|
|
10497
10705
|
}
|
|
10706
|
+
function ignoreRender(ui, value) {
|
|
10707
|
+
const { leafer } = ui;
|
|
10708
|
+
if (leafer && leafer.viewReady)
|
|
10709
|
+
leafer.renderer.ignore = value;
|
|
10710
|
+
}
|
|
10498
10711
|
|
|
10499
10712
|
const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
|
|
10500
10713
|
const { ceil, abs: abs$1 } = Math;
|
|
10501
10714
|
function createPattern(ui, paint, pixelRatio) {
|
|
10502
|
-
let { scaleX, scaleY } = ui.
|
|
10715
|
+
let { scaleX, scaleY } = ui.__nowWorld;
|
|
10503
10716
|
const id = scaleX + '-' + scaleY;
|
|
10504
10717
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10505
10718
|
scaleX = abs$1(scaleX);
|
|
@@ -10561,7 +10774,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10561
10774
|
|
|
10562
10775
|
const { abs } = Math;
|
|
10563
10776
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
10564
|
-
const { scaleX, scaleY } = ui.
|
|
10777
|
+
const { scaleX, scaleY } = ui.__nowWorld;
|
|
10565
10778
|
if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
|
|
10566
10779
|
return false;
|
|
10567
10780
|
}
|
|
@@ -10603,7 +10816,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
10603
10816
|
if (!paint.patternTask) {
|
|
10604
10817
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
10605
10818
|
paint.patternTask = null;
|
|
10606
|
-
if (canvas.bounds.hit(ui.
|
|
10819
|
+
if (canvas.bounds.hit(ui.__nowWorld))
|
|
10607
10820
|
createPattern(ui, paint, canvas.pixelRatio);
|
|
10608
10821
|
ui.forceUpdate('surface');
|
|
10609
10822
|
}), 300);
|
|
@@ -10840,8 +11053,8 @@ function innerShadow(ui, current, shape) {
|
|
|
10840
11053
|
|
|
10841
11054
|
function blur(ui, current, origin) {
|
|
10842
11055
|
const { blur } = ui.__;
|
|
10843
|
-
origin.setWorldBlur(blur * ui.
|
|
10844
|
-
origin.copyWorldToInner(current, ui.
|
|
11056
|
+
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
11057
|
+
origin.copyWorldToInner(current, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10845
11058
|
origin.filter = 'none';
|
|
10846
11059
|
}
|
|
10847
11060
|
|
|
@@ -11472,10 +11685,10 @@ const ExportModule = {
|
|
|
11472
11685
|
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
11473
11686
|
}
|
|
11474
11687
|
else {
|
|
11475
|
-
|
|
11688
|
+
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
11476
11689
|
scaleX = worldTransform.scaleX;
|
|
11477
11690
|
scaleY = worldTransform.scaleY;
|
|
11478
|
-
switch (
|
|
11691
|
+
switch (relative) {
|
|
11479
11692
|
case 'inner':
|
|
11480
11693
|
matrix.set(worldTransform).invert();
|
|
11481
11694
|
break;
|
|
@@ -11488,11 +11701,18 @@ const ExportModule = {
|
|
|
11488
11701
|
scaleX = 1;
|
|
11489
11702
|
scaleY = 1;
|
|
11490
11703
|
break;
|
|
11704
|
+
case 'page':
|
|
11705
|
+
relative = leaf.leafer;
|
|
11706
|
+
default:
|
|
11707
|
+
matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert();
|
|
11708
|
+
const l = relative.worldTransform;
|
|
11709
|
+
scaleX /= scaleX / l.scaleX;
|
|
11710
|
+
scaleY /= scaleY / l.scaleY;
|
|
11491
11711
|
}
|
|
11492
|
-
renderBounds = leaf.getBounds('render',
|
|
11712
|
+
renderBounds = leaf.getBounds('render', relative);
|
|
11493
11713
|
}
|
|
11494
|
-
const { x, y, width, height } = new Bounds(renderBounds).scale(scale)
|
|
11495
|
-
let canvas = Creator.canvas({ width, height, pixelRatio });
|
|
11714
|
+
const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
|
|
11715
|
+
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
|
|
11496
11716
|
const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
11497
11717
|
if (slice) {
|
|
11498
11718
|
leaf = leafer;
|
|
@@ -11554,4 +11774,4 @@ Object.assign(Creator, {
|
|
|
11554
11774
|
});
|
|
11555
11775
|
useCanvas();
|
|
11556
11776
|
|
|
11557
|
-
export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule };
|
|
11777
|
+
export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, useCanvas, useModule, zoomLayerType };
|