leafer-ui 1.0.0-rc.17 → 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.js
CHANGED
|
@@ -41,6 +41,18 @@ var LeaferUI = (function (exports) {
|
|
|
41
41
|
value = max;
|
|
42
42
|
return value;
|
|
43
43
|
},
|
|
44
|
+
minus(value, isFourNumber) {
|
|
45
|
+
if (value instanceof Array) {
|
|
46
|
+
if (isFourNumber)
|
|
47
|
+
value = MathHelper.fourNumber(value);
|
|
48
|
+
for (let i = 0; i < value.length; i++)
|
|
49
|
+
value[i] = -value[i];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
value = -value;
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
},
|
|
44
56
|
fourNumber(num, maxValue) {
|
|
45
57
|
let data;
|
|
46
58
|
if (num instanceof Array) {
|
|
@@ -724,7 +736,7 @@ var LeaferUI = (function (exports) {
|
|
|
724
736
|
|
|
725
737
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$3, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
|
|
726
738
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
727
|
-
const { float } = MathHelper;
|
|
739
|
+
const { float, fourNumber } = MathHelper;
|
|
728
740
|
const { floor, ceil: ceil$2 } = Math;
|
|
729
741
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
730
742
|
const point = {};
|
|
@@ -744,9 +756,15 @@ var LeaferUI = (function (exports) {
|
|
|
744
756
|
t.height = bounds.height;
|
|
745
757
|
},
|
|
746
758
|
copyAndSpread(t, bounds, spreadX, spreadY) {
|
|
747
|
-
if (
|
|
748
|
-
|
|
749
|
-
|
|
759
|
+
if (spreadX instanceof Array) {
|
|
760
|
+
const four = fourNumber(spreadX);
|
|
761
|
+
B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
if (!spreadY)
|
|
765
|
+
spreadY = spreadX;
|
|
766
|
+
B.set(t, bounds.x - spreadX, bounds.y - spreadY, bounds.width + spreadX * 2, bounds.height + spreadY * 2);
|
|
767
|
+
}
|
|
750
768
|
},
|
|
751
769
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
752
770
|
minY(t) { return t.height > 0 ? t.y : t.y + t.height; },
|
|
@@ -1024,8 +1042,12 @@ var LeaferUI = (function (exports) {
|
|
|
1024
1042
|
getFitMatrix(put) {
|
|
1025
1043
|
return BoundsHelper.getFitMatrix(this, put);
|
|
1026
1044
|
}
|
|
1027
|
-
spread(
|
|
1028
|
-
BoundsHelper.spread(this,
|
|
1045
|
+
spread(fourNumber, spreadY) {
|
|
1046
|
+
BoundsHelper.spread(this, fourNumber, spreadY);
|
|
1047
|
+
return this;
|
|
1048
|
+
}
|
|
1049
|
+
shrink(fourNumber) {
|
|
1050
|
+
BoundsHelper.spread(this, MathHelper.minus(fourNumber, true));
|
|
1029
1051
|
return this;
|
|
1030
1052
|
}
|
|
1031
1053
|
ceil() {
|
|
@@ -1450,17 +1472,30 @@ var LeaferUI = (function (exports) {
|
|
|
1450
1472
|
if (this.__input && this.__input[name] !== undefined)
|
|
1451
1473
|
this.__input[name] = undefined;
|
|
1452
1474
|
}
|
|
1453
|
-
__getInputData() {
|
|
1454
|
-
const data = {
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1475
|
+
__getInputData(names) {
|
|
1476
|
+
const data = {};
|
|
1477
|
+
if (names) {
|
|
1478
|
+
if (names instanceof Array) {
|
|
1479
|
+
for (let name of names)
|
|
1480
|
+
data[name] = this.__getInput(name);
|
|
1481
|
+
}
|
|
1482
|
+
else {
|
|
1483
|
+
for (let name in names)
|
|
1484
|
+
data[name] = this.__getInput(name);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
else {
|
|
1488
|
+
let value, inputValue, { __input } = this;
|
|
1489
|
+
data.tag = this.__leaf.tag;
|
|
1490
|
+
for (let key in this) {
|
|
1491
|
+
if (key[0] !== '_') {
|
|
1492
|
+
value = this['_' + key];
|
|
1493
|
+
if (value !== undefined) {
|
|
1494
|
+
if (key === 'path' && !this.__pathInputed)
|
|
1495
|
+
continue;
|
|
1496
|
+
inputValue = __input ? __input[key] : undefined;
|
|
1497
|
+
data[key] = (inputValue === undefined) ? value : inputValue;
|
|
1498
|
+
}
|
|
1464
1499
|
}
|
|
1465
1500
|
}
|
|
1466
1501
|
}
|
|
@@ -2821,12 +2856,16 @@ var LeaferUI = (function (exports) {
|
|
|
2821
2856
|
set path(value) { this.__path = value; }
|
|
2822
2857
|
get path() { return this.__path; }
|
|
2823
2858
|
constructor(path) {
|
|
2859
|
+
this.set(path);
|
|
2860
|
+
}
|
|
2861
|
+
set(path) {
|
|
2824
2862
|
if (path) {
|
|
2825
2863
|
this.__path = typeof path === 'string' ? PathHelper.parse(path) : path;
|
|
2826
2864
|
}
|
|
2827
2865
|
else {
|
|
2828
2866
|
this.__path = [];
|
|
2829
2867
|
}
|
|
2868
|
+
return this;
|
|
2830
2869
|
}
|
|
2831
2870
|
beginPath() {
|
|
2832
2871
|
beginPath(this.__path);
|
|
@@ -3140,6 +3179,7 @@ var LeaferUI = (function (exports) {
|
|
|
3140
3179
|
PathHelper.creator = new PathCreator();
|
|
3141
3180
|
PathHelper.parse = PathConvert.parse;
|
|
3142
3181
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3182
|
+
const pen = new PathCreator();
|
|
3143
3183
|
|
|
3144
3184
|
const { drawRoundRect } = RectHelper;
|
|
3145
3185
|
function roundRect(drawer) {
|
|
@@ -3424,7 +3464,7 @@ var LeaferUI = (function (exports) {
|
|
|
3424
3464
|
},
|
|
3425
3465
|
clearRecycled() {
|
|
3426
3466
|
const list = I$1.recycledList;
|
|
3427
|
-
if (list.length) {
|
|
3467
|
+
if (list.length > 100) {
|
|
3428
3468
|
list.forEach(image => {
|
|
3429
3469
|
if (!image.use && image.url) {
|
|
3430
3470
|
delete I$1.map[image.url];
|
|
@@ -3676,6 +3716,8 @@ var LeaferUI = (function (exports) {
|
|
|
3676
3716
|
}
|
|
3677
3717
|
function doStrokeType(leaf) {
|
|
3678
3718
|
leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
|
|
3719
|
+
if (leaf.__.__useArrow)
|
|
3720
|
+
doBoundsType(leaf);
|
|
3679
3721
|
}
|
|
3680
3722
|
const strokeType = affectStrokeBoundsType;
|
|
3681
3723
|
function affectRenderBoundsType(defaultValue) {
|
|
@@ -3879,131 +3921,411 @@ var LeaferUI = (function (exports) {
|
|
|
3879
3921
|
};
|
|
3880
3922
|
}
|
|
3881
3923
|
|
|
3882
|
-
const
|
|
3883
|
-
const
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
get e() { return this.leaf.__.x; }
|
|
3894
|
-
get f() { return this.leaf.__.y; }
|
|
3895
|
-
get x() { return this.e + this.boxBounds.x; }
|
|
3896
|
-
get y() { return this.f + this.boxBounds.y; }
|
|
3897
|
-
get width() { return this.boxBounds.width; }
|
|
3898
|
-
get height() { return this.boxBounds.height; }
|
|
3899
|
-
constructor(leaf) {
|
|
3900
|
-
this.leaf = leaf;
|
|
3901
|
-
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
3902
|
-
if (this.leaf.__local)
|
|
3903
|
-
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
3904
|
-
this.boxChange();
|
|
3905
|
-
this.matrixChange();
|
|
3906
|
-
}
|
|
3907
|
-
createLocal() {
|
|
3908
|
-
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 };
|
|
3909
|
-
if (!this._localStrokeBounds)
|
|
3910
|
-
this._localStrokeBounds = local;
|
|
3911
|
-
if (!this._localRenderBounds)
|
|
3912
|
-
this._localRenderBounds = local;
|
|
3913
|
-
}
|
|
3914
|
-
update() {
|
|
3915
|
-
const { leafer } = this.leaf;
|
|
3916
|
-
if (leafer) {
|
|
3917
|
-
if (leafer.ready) {
|
|
3918
|
-
if (leafer.watcher.changed)
|
|
3919
|
-
leafer.layouter.layout();
|
|
3924
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3925
|
+
const matrix = {};
|
|
3926
|
+
const LeafHelper = {
|
|
3927
|
+
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
3928
|
+
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
3929
|
+
waitAutoLayout = true;
|
|
3930
|
+
updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
|
|
3931
|
+
if (leaf.isBranch) {
|
|
3932
|
+
const { children } = leaf;
|
|
3933
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3934
|
+
updateAllMatrix$3(children[i], checkAutoLayout, waitAutoLayout);
|
|
3920
3935
|
}
|
|
3921
|
-
|
|
3922
|
-
|
|
3936
|
+
}
|
|
3937
|
+
},
|
|
3938
|
+
updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
3939
|
+
const layout = leaf.__layout;
|
|
3940
|
+
if (checkAutoLayout) {
|
|
3941
|
+
if (waitAutoLayout) {
|
|
3942
|
+
layout.waitAutoLayout = true;
|
|
3943
|
+
if (leaf.__hasAutoLayout)
|
|
3944
|
+
layout.matrixChanged = false;
|
|
3923
3945
|
}
|
|
3924
3946
|
}
|
|
3925
|
-
else {
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3947
|
+
else if (layout.waitAutoLayout) {
|
|
3948
|
+
layout.waitAutoLayout = false;
|
|
3949
|
+
}
|
|
3950
|
+
if (layout.matrixChanged)
|
|
3951
|
+
leaf.__updateLocalMatrix();
|
|
3952
|
+
if (!layout.waitAutoLayout)
|
|
3953
|
+
leaf.__updateWorldMatrix();
|
|
3954
|
+
},
|
|
3955
|
+
updateBounds(leaf) {
|
|
3956
|
+
const layout = leaf.__layout;
|
|
3957
|
+
if (layout.boundsChanged)
|
|
3958
|
+
leaf.__updateLocalBounds();
|
|
3959
|
+
if (!layout.waitAutoLayout)
|
|
3960
|
+
leaf.__updateWorldBounds();
|
|
3961
|
+
},
|
|
3962
|
+
updateAllWorldOpacity(leaf) {
|
|
3963
|
+
leaf.__updateWorldOpacity();
|
|
3964
|
+
if (leaf.isBranch) {
|
|
3965
|
+
const { children } = leaf;
|
|
3966
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3967
|
+
updateAllWorldOpacity$1(children[i]);
|
|
3929
3968
|
}
|
|
3930
|
-
Platform.layout(root);
|
|
3931
3969
|
}
|
|
3932
|
-
}
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
return MatrixHelper.defaultMatrix;
|
|
3942
|
-
default:
|
|
3943
|
-
return new Matrix(this.leaf.__world).divideParent(relative.__world);
|
|
3970
|
+
},
|
|
3971
|
+
updateAllChange(leaf) {
|
|
3972
|
+
updateAllWorldOpacity$1(leaf);
|
|
3973
|
+
leaf.__updateChange();
|
|
3974
|
+
if (leaf.isBranch) {
|
|
3975
|
+
const { children } = leaf;
|
|
3976
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3977
|
+
updateAllChange$1(children[i]);
|
|
3978
|
+
}
|
|
3944
3979
|
}
|
|
3945
|
-
}
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
case 'local':
|
|
3952
|
-
return this.getLocalBounds(type);
|
|
3953
|
-
case 'inner':
|
|
3954
|
-
return this.getInnerBounds(type);
|
|
3955
|
-
default:
|
|
3956
|
-
return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
|
|
3980
|
+
},
|
|
3981
|
+
worldHittable(t) {
|
|
3982
|
+
while (t) {
|
|
3983
|
+
if (!t.__.hittable)
|
|
3984
|
+
return false;
|
|
3985
|
+
t = t.parent;
|
|
3957
3986
|
}
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3987
|
+
return true;
|
|
3988
|
+
},
|
|
3989
|
+
moveWorld(t, x, y) {
|
|
3990
|
+
const local = { x, y };
|
|
3991
|
+
if (t.parent)
|
|
3992
|
+
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3993
|
+
L.moveLocal(t, local.x, local.y);
|
|
3994
|
+
},
|
|
3995
|
+
moveLocal(t, x, y = 0) {
|
|
3996
|
+
t.x += x;
|
|
3997
|
+
t.y += y;
|
|
3998
|
+
},
|
|
3999
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4000
|
+
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4001
|
+
},
|
|
4002
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4003
|
+
copy$6(matrix, t.__localMatrix);
|
|
4004
|
+
scaleOfOuter$3(matrix, origin, scaleX, scaleY);
|
|
4005
|
+
moveByMatrix(t, matrix);
|
|
4006
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4007
|
+
},
|
|
4008
|
+
rotateOfWorld(t, origin, angle) {
|
|
4009
|
+
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4010
|
+
},
|
|
4011
|
+
rotateOfLocal(t, origin, angle) {
|
|
4012
|
+
copy$6(matrix, t.__localMatrix);
|
|
4013
|
+
rotateOfOuter$3(matrix, origin, angle);
|
|
4014
|
+
moveByMatrix(t, matrix);
|
|
4015
|
+
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4016
|
+
},
|
|
4017
|
+
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4018
|
+
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4019
|
+
},
|
|
4020
|
+
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4021
|
+
copy$6(matrix, t.__localMatrix);
|
|
4022
|
+
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4023
|
+
L.setTransform(t, matrix, resize);
|
|
4024
|
+
},
|
|
4025
|
+
transformWorld(t, transform, resize) {
|
|
4026
|
+
copy$6(matrix, t.worldTransform);
|
|
4027
|
+
multiplyParent$2(matrix, transform);
|
|
4028
|
+
if (t.parent)
|
|
4029
|
+
divideParent(matrix, t.parent.worldTransform);
|
|
4030
|
+
L.setTransform(t, matrix, resize);
|
|
4031
|
+
},
|
|
4032
|
+
transform(t, transform, resize) {
|
|
4033
|
+
copy$6(matrix, t.localTransform);
|
|
4034
|
+
multiplyParent$2(matrix, transform);
|
|
4035
|
+
L.setTransform(t, matrix, resize);
|
|
4036
|
+
},
|
|
4037
|
+
setTransform(t, transform, resize) {
|
|
4038
|
+
const layout = getLayout(transform);
|
|
4039
|
+
if (resize) {
|
|
4040
|
+
t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
|
|
4041
|
+
delete layout.scaleX;
|
|
4042
|
+
delete layout.scaleY;
|
|
3971
4043
|
}
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
4044
|
+
t.set(layout);
|
|
4045
|
+
},
|
|
4046
|
+
getRelativeWorld(t, relative, temp) {
|
|
4047
|
+
copy$6(matrix, t.worldTransform);
|
|
4048
|
+
divideParent(matrix, relative.worldTransform);
|
|
4049
|
+
return temp ? matrix : Object.assign({}, matrix);
|
|
4050
|
+
},
|
|
4051
|
+
drop(t, parent, index, resize) {
|
|
4052
|
+
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4053
|
+
parent.add(t, index);
|
|
4054
|
+
},
|
|
4055
|
+
hasParent(p, parent) {
|
|
4056
|
+
if (!parent)
|
|
4057
|
+
return false;
|
|
4058
|
+
while (p) {
|
|
4059
|
+
if (parent === p)
|
|
4060
|
+
return true;
|
|
4061
|
+
p = p.parent;
|
|
3983
4062
|
}
|
|
3984
|
-
}
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
if (this.contentBounds)
|
|
3991
|
-
return this.getWorldContentBounds();
|
|
3992
|
-
case 'margin':
|
|
3993
|
-
case 'box':
|
|
3994
|
-
return this.getWorldBoxBounds();
|
|
3995
|
-
case 'margin':
|
|
3996
|
-
case 'stroke':
|
|
3997
|
-
return this.getWorldStrokeBounds();
|
|
4063
|
+
},
|
|
4064
|
+
hasParentAutoLayout(p) {
|
|
4065
|
+
while (p.parent) {
|
|
4066
|
+
p = p.parent;
|
|
4067
|
+
if (p.__hasAutoLayout)
|
|
4068
|
+
return true;
|
|
3998
4069
|
}
|
|
3999
4070
|
}
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4071
|
+
};
|
|
4072
|
+
const L = LeafHelper;
|
|
4073
|
+
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
|
|
4074
|
+
function moveByMatrix(t, matrix) {
|
|
4075
|
+
const { e, f } = t.__localMatrix;
|
|
4076
|
+
t.x += matrix.e - e;
|
|
4077
|
+
t.y += matrix.f - f;
|
|
4078
|
+
}
|
|
4079
|
+
function getTempLocal(t, world) {
|
|
4080
|
+
t.__layout.update();
|
|
4081
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4082
|
+
}
|
|
4083
|
+
|
|
4084
|
+
const LeafBoundsHelper = {
|
|
4085
|
+
worldBounds(target) {
|
|
4086
|
+
return target.__world;
|
|
4087
|
+
},
|
|
4088
|
+
localBoxBounds(target) {
|
|
4089
|
+
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4090
|
+
},
|
|
4091
|
+
localStrokeBounds(target) {
|
|
4092
|
+
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4093
|
+
},
|
|
4094
|
+
localRenderBounds(target) {
|
|
4095
|
+
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4096
|
+
},
|
|
4097
|
+
maskLocalBoxBounds(target) {
|
|
4098
|
+
return target.__.mask ? target.__localBoxBounds : null;
|
|
4099
|
+
},
|
|
4100
|
+
maskLocalStrokeBounds(target) {
|
|
4101
|
+
return target.__.mask ? target.__layout.localStrokeBounds : null;
|
|
4102
|
+
},
|
|
4103
|
+
maskLocalRenderBounds(target) {
|
|
4104
|
+
return target.__.mask ? target.__layout.localRenderBounds : null;
|
|
4105
|
+
},
|
|
4106
|
+
excludeRenderBounds(child, options) {
|
|
4107
|
+
if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
|
|
4108
|
+
return true;
|
|
4109
|
+
if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
|
|
4110
|
+
return true;
|
|
4111
|
+
return false;
|
|
4112
|
+
}
|
|
4113
|
+
};
|
|
4114
|
+
|
|
4115
|
+
const { updateBounds: updateBounds$2 } = LeafHelper;
|
|
4116
|
+
const BranchHelper = {
|
|
4117
|
+
sort(a, b) {
|
|
4118
|
+
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
4119
|
+
},
|
|
4120
|
+
pushAllChildBranch(branch, leafList) {
|
|
4121
|
+
branch.__tempNumber = 1;
|
|
4122
|
+
if (branch.__.__childBranchNumber) {
|
|
4123
|
+
const { children } = branch;
|
|
4124
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4125
|
+
branch = children[i];
|
|
4126
|
+
if (branch.isBranch) {
|
|
4127
|
+
branch.__tempNumber = 1;
|
|
4128
|
+
leafList.add(branch);
|
|
4129
|
+
pushAllChildBranch$1(branch, leafList);
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4132
|
+
}
|
|
4133
|
+
},
|
|
4134
|
+
pushAllParent(leaf, leafList) {
|
|
4135
|
+
const { keys } = leafList;
|
|
4136
|
+
if (keys) {
|
|
4137
|
+
while (leaf.parent) {
|
|
4138
|
+
if (keys[leaf.parent.innerId] === undefined) {
|
|
4139
|
+
leafList.add(leaf.parent);
|
|
4140
|
+
leaf = leaf.parent;
|
|
4141
|
+
}
|
|
4142
|
+
else {
|
|
4143
|
+
break;
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
else {
|
|
4148
|
+
while (leaf.parent) {
|
|
4149
|
+
leafList.add(leaf.parent);
|
|
4150
|
+
leaf = leaf.parent;
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
},
|
|
4154
|
+
pushAllBranchStack(branch, pushList) {
|
|
4155
|
+
let start = pushList.length;
|
|
4156
|
+
const { children } = branch;
|
|
4157
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4158
|
+
if (children[i].isBranch) {
|
|
4159
|
+
pushList.push(children[i]);
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
for (let i = start, len = pushList.length; i < len; i++) {
|
|
4163
|
+
pushAllBranchStack(pushList[i], pushList);
|
|
4164
|
+
}
|
|
4165
|
+
},
|
|
4166
|
+
updateBounds(branch, exclude) {
|
|
4167
|
+
const branchStack = [branch];
|
|
4168
|
+
pushAllBranchStack(branch, branchStack);
|
|
4169
|
+
updateBoundsByBranchStack(branchStack, exclude);
|
|
4170
|
+
},
|
|
4171
|
+
updateBoundsByBranchStack(branchStack, exclude) {
|
|
4172
|
+
let branch, children;
|
|
4173
|
+
for (let i = branchStack.length - 1; i > -1; i--) {
|
|
4174
|
+
branch = branchStack[i];
|
|
4175
|
+
children = branch.children;
|
|
4176
|
+
for (let j = 0, len = children.length; j < len; j++) {
|
|
4177
|
+
updateBounds$2(children[j]);
|
|
4178
|
+
}
|
|
4179
|
+
if (exclude && exclude === branch)
|
|
4180
|
+
continue;
|
|
4181
|
+
updateBounds$2(branch);
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
};
|
|
4185
|
+
const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
|
|
4186
|
+
|
|
4187
|
+
const WaitHelper = {
|
|
4188
|
+
run(wait) {
|
|
4189
|
+
if (wait.length) {
|
|
4190
|
+
const len = wait.length;
|
|
4191
|
+
for (let i = 0; i < len; i++) {
|
|
4192
|
+
wait[i]();
|
|
4193
|
+
}
|
|
4194
|
+
wait.length === len ? wait.length = 0 : wait.splice(0, len);
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
};
|
|
4198
|
+
|
|
4199
|
+
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4200
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4201
|
+
class LeafLayout {
|
|
4202
|
+
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4203
|
+
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4204
|
+
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4205
|
+
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4206
|
+
get a() { return 1; }
|
|
4207
|
+
get b() { return 0; }
|
|
4208
|
+
get c() { return 0; }
|
|
4209
|
+
get d() { return 1; }
|
|
4210
|
+
get e() { return this.leaf.__.x; }
|
|
4211
|
+
get f() { return this.leaf.__.y; }
|
|
4212
|
+
get x() { return this.e + this.boxBounds.x; }
|
|
4213
|
+
get y() { return this.f + this.boxBounds.y; }
|
|
4214
|
+
get width() { return this.boxBounds.width; }
|
|
4215
|
+
get height() { return this.boxBounds.height; }
|
|
4216
|
+
constructor(leaf) {
|
|
4217
|
+
this.leaf = leaf;
|
|
4218
|
+
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4219
|
+
if (this.leaf.__local)
|
|
4220
|
+
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
4221
|
+
this.boxChange();
|
|
4222
|
+
this.matrixChange();
|
|
4223
|
+
}
|
|
4224
|
+
createLocal() {
|
|
4225
|
+
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 };
|
|
4226
|
+
if (!this._localStrokeBounds)
|
|
4227
|
+
this._localStrokeBounds = local;
|
|
4228
|
+
if (!this._localRenderBounds)
|
|
4229
|
+
this._localRenderBounds = local;
|
|
4230
|
+
}
|
|
4231
|
+
update() {
|
|
4232
|
+
const { leafer } = this.leaf;
|
|
4233
|
+
if (leafer) {
|
|
4234
|
+
if (leafer.ready) {
|
|
4235
|
+
if (leafer.watcher.changed)
|
|
4236
|
+
leafer.layouter.layout();
|
|
4237
|
+
}
|
|
4238
|
+
else {
|
|
4239
|
+
leafer.start();
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
else {
|
|
4243
|
+
let root = this.leaf;
|
|
4244
|
+
while (root.parent && !root.parent.leafer) {
|
|
4245
|
+
root = root.parent;
|
|
4246
|
+
}
|
|
4247
|
+
Platform.layout(root);
|
|
4248
|
+
}
|
|
4249
|
+
}
|
|
4250
|
+
getTransform(relative = 'world') {
|
|
4251
|
+
this.update();
|
|
4252
|
+
const { leaf } = this;
|
|
4253
|
+
switch (relative) {
|
|
4254
|
+
case 'world':
|
|
4255
|
+
return leaf.__world;
|
|
4256
|
+
case 'local':
|
|
4257
|
+
return leaf.__localMatrix;
|
|
4258
|
+
case 'inner':
|
|
4259
|
+
return MatrixHelper.defaultMatrix;
|
|
4260
|
+
case 'page':
|
|
4261
|
+
relative = leaf.zoomLayer;
|
|
4262
|
+
default:
|
|
4263
|
+
return getRelativeWorld$1(leaf, relative);
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
getBounds(type, relative = 'world') {
|
|
4267
|
+
this.update();
|
|
4268
|
+
switch (relative) {
|
|
4269
|
+
case 'world':
|
|
4270
|
+
return this.getWorldBounds(type);
|
|
4271
|
+
case 'local':
|
|
4272
|
+
return this.getLocalBounds(type);
|
|
4273
|
+
case 'inner':
|
|
4274
|
+
return this.getInnerBounds(type);
|
|
4275
|
+
case 'page':
|
|
4276
|
+
relative = this.leaf.zoomLayer;
|
|
4277
|
+
default:
|
|
4278
|
+
return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
4281
|
+
getInnerBounds(type = 'box') {
|
|
4282
|
+
switch (type) {
|
|
4283
|
+
case 'render':
|
|
4284
|
+
return this.renderBounds;
|
|
4285
|
+
case 'content':
|
|
4286
|
+
if (this.contentBounds)
|
|
4287
|
+
return this.contentBounds;
|
|
4288
|
+
case 'margin':
|
|
4289
|
+
case 'box':
|
|
4290
|
+
return this.boxBounds;
|
|
4291
|
+
case 'stroke':
|
|
4292
|
+
return this.strokeBounds;
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
getLocalBounds(type = 'box') {
|
|
4296
|
+
switch (type) {
|
|
4297
|
+
case 'render':
|
|
4298
|
+
return this.localRenderBounds;
|
|
4299
|
+
case 'stroke':
|
|
4300
|
+
return this.localStrokeBounds;
|
|
4301
|
+
case 'margin':
|
|
4302
|
+
case 'content':
|
|
4303
|
+
case 'box':
|
|
4304
|
+
return this.leaf.__localBoxBounds;
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
getWorldBounds(type = 'box') {
|
|
4308
|
+
switch (type) {
|
|
4309
|
+
case 'render':
|
|
4310
|
+
return this.leaf.__world;
|
|
4311
|
+
case 'content':
|
|
4312
|
+
if (this.contentBounds)
|
|
4313
|
+
return this.getWorldContentBounds();
|
|
4314
|
+
case 'margin':
|
|
4315
|
+
case 'box':
|
|
4316
|
+
return this.getWorldBoxBounds();
|
|
4317
|
+
case 'margin':
|
|
4318
|
+
case 'stroke':
|
|
4319
|
+
return this.getWorldStrokeBounds();
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4323
|
+
const { leaf } = this;
|
|
4324
|
+
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4325
|
+
switch (relative) {
|
|
4326
|
+
case 'world':
|
|
4327
|
+
point = leaf.getWorldPoint(bounds);
|
|
4328
|
+
matrix = leaf.__world;
|
|
4007
4329
|
break;
|
|
4008
4330
|
case 'local':
|
|
4009
4331
|
point = leaf.getLocalPointByInner(bounds);
|
|
@@ -4013,12 +4335,14 @@ var LeaferUI = (function (exports) {
|
|
|
4013
4335
|
point = bounds;
|
|
4014
4336
|
matrix = MatrixHelper.defaultMatrix;
|
|
4015
4337
|
break;
|
|
4338
|
+
case 'page':
|
|
4339
|
+
relative = leaf.zoomLayer;
|
|
4016
4340
|
default:
|
|
4017
4341
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4018
|
-
matrix =
|
|
4342
|
+
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4019
4343
|
}
|
|
4020
4344
|
const layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4021
|
-
copy$
|
|
4345
|
+
copy$5(layoutBounds, bounds);
|
|
4022
4346
|
PointHelper.copy(layoutBounds, point);
|
|
4023
4347
|
if (unscale) {
|
|
4024
4348
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -4046,6 +4370,8 @@ var LeaferUI = (function (exports) {
|
|
|
4046
4370
|
break;
|
|
4047
4371
|
case 'inner':
|
|
4048
4372
|
break;
|
|
4373
|
+
case 'page':
|
|
4374
|
+
relative = leaf.zoomLayer;
|
|
4049
4375
|
default:
|
|
4050
4376
|
relativeLeaf = relative;
|
|
4051
4377
|
}
|
|
@@ -4385,359 +4711,87 @@ var LeaferUI = (function (exports) {
|
|
|
4385
4711
|
this.times = times;
|
|
4386
4712
|
if (bounds) {
|
|
4387
4713
|
this.renderBounds = bounds;
|
|
4388
|
-
this.renderOptions = options;
|
|
4389
|
-
}
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
RenderEvent.REQUEST = 'render.request';
|
|
4393
|
-
RenderEvent.START = 'render.start';
|
|
4394
|
-
RenderEvent.BEFORE = 'render.before';
|
|
4395
|
-
RenderEvent.RENDER = 'render';
|
|
4396
|
-
RenderEvent.AFTER = 'render.after';
|
|
4397
|
-
RenderEvent.AGAIN = 'render.again';
|
|
4398
|
-
RenderEvent.END = 'render.end';
|
|
4399
|
-
RenderEvent.NEXT = 'render.next';
|
|
4400
|
-
|
|
4401
|
-
class LeaferEvent extends Event {
|
|
4402
|
-
}
|
|
4403
|
-
LeaferEvent.START = 'leafer.start';
|
|
4404
|
-
LeaferEvent.BEFORE_READY = 'leafer.before_ready';
|
|
4405
|
-
LeaferEvent.READY = 'leafer.ready';
|
|
4406
|
-
LeaferEvent.AFTER_READY = 'leafer.after_ready';
|
|
4407
|
-
LeaferEvent.VIEW_READY = 'leafer.view_ready';
|
|
4408
|
-
LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
|
|
4409
|
-
LeaferEvent.STOP = 'leafer.stop';
|
|
4410
|
-
LeaferEvent.RESTART = 'leafer.restart';
|
|
4411
|
-
LeaferEvent.END = 'leafer.end';
|
|
4412
|
-
|
|
4413
|
-
const LeafDataProxy = {
|
|
4414
|
-
__setAttr(name, newValue) {
|
|
4415
|
-
if (this.leafer && this.leafer.created) {
|
|
4416
|
-
const oldValue = this.__.__getInput(name);
|
|
4417
|
-
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4418
|
-
this.__[name] = newValue;
|
|
4419
|
-
if (this.__proxyData)
|
|
4420
|
-
this.setProxyAttr(name, newValue);
|
|
4421
|
-
const { CHANGE } = PropertyEvent;
|
|
4422
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4423
|
-
if (this.isLeafer) {
|
|
4424
|
-
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
4425
|
-
}
|
|
4426
|
-
else {
|
|
4427
|
-
if (this.hasEvent(CHANGE))
|
|
4428
|
-
this.emitEvent(event);
|
|
4429
|
-
}
|
|
4430
|
-
this.leafer.emitEvent(event);
|
|
4431
|
-
}
|
|
4432
|
-
}
|
|
4433
|
-
else {
|
|
4434
|
-
this.__[name] = newValue;
|
|
4435
|
-
if (this.__proxyData)
|
|
4436
|
-
this.setProxyAttr(name, newValue);
|
|
4437
|
-
}
|
|
4438
|
-
},
|
|
4439
|
-
__getAttr(name) {
|
|
4440
|
-
if (this.__proxyData)
|
|
4441
|
-
return this.getProxyAttr(name);
|
|
4442
|
-
return this.__.__get(name);
|
|
4443
|
-
}
|
|
4444
|
-
};
|
|
4445
|
-
|
|
4446
|
-
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
4447
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4448
|
-
const LeafMatrix = {
|
|
4449
|
-
__updateWorldMatrix() {
|
|
4450
|
-
multiplyParent$2(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4451
|
-
},
|
|
4452
|
-
__updateLocalMatrix() {
|
|
4453
|
-
if (this.__local) {
|
|
4454
|
-
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4455
|
-
if (layout.affectScaleOrRotation) {
|
|
4456
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4457
|
-
setLayout(local, data, null, layout.affectRotation);
|
|
4458
|
-
layout.scaleChanged = layout.rotationChanged = false;
|
|
4459
|
-
}
|
|
4460
|
-
}
|
|
4461
|
-
local.e = data.x;
|
|
4462
|
-
local.f = data.y;
|
|
4463
|
-
if (data.around) {
|
|
4464
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4465
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4466
|
-
}
|
|
4467
|
-
}
|
|
4468
|
-
this.__layout.matrixChanged = false;
|
|
4469
|
-
}
|
|
4470
|
-
};
|
|
4471
|
-
|
|
4472
|
-
const { copy: copy$5, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$1, divideParent, getLayout } = MatrixHelper;
|
|
4473
|
-
const matrix = {};
|
|
4474
|
-
const LeafHelper = {
|
|
4475
|
-
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4476
|
-
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
4477
|
-
waitAutoLayout = true;
|
|
4478
|
-
updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
|
|
4479
|
-
if (leaf.isBranch) {
|
|
4480
|
-
const { children } = leaf;
|
|
4481
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4482
|
-
updateAllMatrix$3(children[i], checkAutoLayout, waitAutoLayout);
|
|
4483
|
-
}
|
|
4484
|
-
}
|
|
4485
|
-
},
|
|
4486
|
-
updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4487
|
-
const layout = leaf.__layout;
|
|
4488
|
-
if (checkAutoLayout) {
|
|
4489
|
-
if (waitAutoLayout) {
|
|
4490
|
-
layout.waitAutoLayout = true;
|
|
4491
|
-
if (leaf.__hasAutoLayout)
|
|
4492
|
-
layout.matrixChanged = false;
|
|
4493
|
-
}
|
|
4494
|
-
}
|
|
4495
|
-
else if (layout.waitAutoLayout) {
|
|
4496
|
-
layout.waitAutoLayout = false;
|
|
4497
|
-
}
|
|
4498
|
-
if (layout.matrixChanged)
|
|
4499
|
-
leaf.__updateLocalMatrix();
|
|
4500
|
-
if (!layout.waitAutoLayout)
|
|
4501
|
-
leaf.__updateWorldMatrix();
|
|
4502
|
-
},
|
|
4503
|
-
updateBounds(leaf) {
|
|
4504
|
-
const layout = leaf.__layout;
|
|
4505
|
-
if (layout.boundsChanged)
|
|
4506
|
-
leaf.__updateLocalBounds();
|
|
4507
|
-
if (!layout.waitAutoLayout)
|
|
4508
|
-
leaf.__updateWorldBounds();
|
|
4509
|
-
},
|
|
4510
|
-
updateAllWorldOpacity(leaf) {
|
|
4511
|
-
leaf.__updateWorldOpacity();
|
|
4512
|
-
if (leaf.isBranch) {
|
|
4513
|
-
const { children } = leaf;
|
|
4514
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4515
|
-
updateAllWorldOpacity$1(children[i]);
|
|
4516
|
-
}
|
|
4517
|
-
}
|
|
4518
|
-
},
|
|
4519
|
-
updateAllChange(leaf) {
|
|
4520
|
-
updateAllWorldOpacity$1(leaf);
|
|
4521
|
-
leaf.__updateChange();
|
|
4522
|
-
if (leaf.isBranch) {
|
|
4523
|
-
const { children } = leaf;
|
|
4524
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4525
|
-
updateAllChange$1(children[i]);
|
|
4526
|
-
}
|
|
4527
|
-
}
|
|
4528
|
-
},
|
|
4529
|
-
worldHittable(t) {
|
|
4530
|
-
while (t) {
|
|
4531
|
-
if (!t.__.hittable)
|
|
4532
|
-
return false;
|
|
4533
|
-
t = t.parent;
|
|
4534
|
-
}
|
|
4535
|
-
return true;
|
|
4536
|
-
},
|
|
4537
|
-
moveWorld(t, x, y) {
|
|
4538
|
-
const local = { x, y };
|
|
4539
|
-
if (t.parent)
|
|
4540
|
-
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
4541
|
-
L.moveLocal(t, local.x, local.y);
|
|
4542
|
-
},
|
|
4543
|
-
moveLocal(t, x, y = 0) {
|
|
4544
|
-
t.x += x;
|
|
4545
|
-
t.y += y;
|
|
4546
|
-
},
|
|
4547
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4548
|
-
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4549
|
-
},
|
|
4550
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4551
|
-
copy$5(matrix, t.__localMatrix);
|
|
4552
|
-
scaleOfOuter$3(matrix, origin, scaleX, scaleY);
|
|
4553
|
-
moveByMatrix(t, matrix);
|
|
4554
|
-
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4555
|
-
},
|
|
4556
|
-
rotateOfWorld(t, origin, angle) {
|
|
4557
|
-
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4558
|
-
},
|
|
4559
|
-
rotateOfLocal(t, origin, angle) {
|
|
4560
|
-
copy$5(matrix, t.__localMatrix);
|
|
4561
|
-
rotateOfOuter$3(matrix, origin, angle);
|
|
4562
|
-
moveByMatrix(t, matrix);
|
|
4563
|
-
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4564
|
-
},
|
|
4565
|
-
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4566
|
-
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4567
|
-
},
|
|
4568
|
-
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4569
|
-
copy$5(matrix, t.__localMatrix);
|
|
4570
|
-
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4571
|
-
L.setTransform(t, matrix, resize);
|
|
4572
|
-
},
|
|
4573
|
-
transformWorld(t, transform, resize) {
|
|
4574
|
-
copy$5(matrix, t.worldTransform);
|
|
4575
|
-
multiplyParent$1(matrix, transform);
|
|
4576
|
-
if (t.parent)
|
|
4577
|
-
divideParent(matrix, t.parent.worldTransform);
|
|
4578
|
-
L.setTransform(t, matrix, resize);
|
|
4579
|
-
},
|
|
4580
|
-
transform(t, transform, resize) {
|
|
4581
|
-
copy$5(matrix, t.localTransform);
|
|
4582
|
-
multiplyParent$1(matrix, transform);
|
|
4583
|
-
L.setTransform(t, matrix, resize);
|
|
4584
|
-
},
|
|
4585
|
-
setTransform(t, transform, resize) {
|
|
4586
|
-
const layout = getLayout(transform);
|
|
4587
|
-
if (resize) {
|
|
4588
|
-
t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
|
|
4589
|
-
delete layout.scaleX;
|
|
4590
|
-
delete layout.scaleY;
|
|
4591
|
-
}
|
|
4592
|
-
t.set(layout);
|
|
4593
|
-
},
|
|
4594
|
-
drop(t, parent, index, resize) {
|
|
4595
|
-
copy$5(matrix, t.worldTransform);
|
|
4596
|
-
divideParent(matrix, parent.worldTransform);
|
|
4597
|
-
t.setTransform(matrix, resize);
|
|
4598
|
-
parent.add(t, index);
|
|
4599
|
-
},
|
|
4600
|
-
hasParent(p, parent) {
|
|
4601
|
-
if (!parent)
|
|
4602
|
-
return false;
|
|
4603
|
-
while (p) {
|
|
4604
|
-
if (parent === p)
|
|
4605
|
-
return true;
|
|
4606
|
-
p = p.parent;
|
|
4607
|
-
}
|
|
4608
|
-
},
|
|
4609
|
-
hasParentAutoLayout(p) {
|
|
4610
|
-
while (p.parent) {
|
|
4611
|
-
p = p.parent;
|
|
4612
|
-
if (p.__hasAutoLayout)
|
|
4613
|
-
return true;
|
|
4614
|
-
}
|
|
4615
|
-
}
|
|
4616
|
-
};
|
|
4617
|
-
const L = LeafHelper;
|
|
4618
|
-
const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
|
|
4619
|
-
function moveByMatrix(t, matrix) {
|
|
4620
|
-
const { e, f } = t.__localMatrix;
|
|
4621
|
-
t.x += matrix.e - e;
|
|
4622
|
-
t.y += matrix.f - f;
|
|
4623
|
-
}
|
|
4624
|
-
function getTempLocal(t, world) {
|
|
4625
|
-
t.__layout.update();
|
|
4626
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4627
|
-
}
|
|
4628
|
-
|
|
4629
|
-
const LeafBoundsHelper = {
|
|
4630
|
-
worldBounds(target) {
|
|
4631
|
-
return target.__world;
|
|
4632
|
-
},
|
|
4633
|
-
localBoxBounds(target) {
|
|
4634
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4635
|
-
},
|
|
4636
|
-
localStrokeBounds(target) {
|
|
4637
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4638
|
-
},
|
|
4639
|
-
localRenderBounds(target) {
|
|
4640
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4641
|
-
},
|
|
4642
|
-
maskLocalBoxBounds(target) {
|
|
4643
|
-
return target.__.mask ? target.__localBoxBounds : null;
|
|
4644
|
-
},
|
|
4645
|
-
maskLocalStrokeBounds(target) {
|
|
4646
|
-
return target.__.mask ? target.__layout.localStrokeBounds : null;
|
|
4647
|
-
},
|
|
4648
|
-
maskLocalRenderBounds(target) {
|
|
4649
|
-
return target.__.mask ? target.__layout.localRenderBounds : null;
|
|
4650
|
-
},
|
|
4651
|
-
excludeRenderBounds(child, options) {
|
|
4652
|
-
if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
|
|
4653
|
-
return true;
|
|
4654
|
-
if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
|
|
4655
|
-
return true;
|
|
4656
|
-
return false;
|
|
4714
|
+
this.renderOptions = options;
|
|
4715
|
+
}
|
|
4657
4716
|
}
|
|
4658
|
-
}
|
|
4717
|
+
}
|
|
4718
|
+
RenderEvent.REQUEST = 'render.request';
|
|
4719
|
+
RenderEvent.START = 'render.start';
|
|
4720
|
+
RenderEvent.BEFORE = 'render.before';
|
|
4721
|
+
RenderEvent.RENDER = 'render';
|
|
4722
|
+
RenderEvent.AFTER = 'render.after';
|
|
4723
|
+
RenderEvent.AGAIN = 'render.again';
|
|
4724
|
+
RenderEvent.END = 'render.end';
|
|
4725
|
+
RenderEvent.NEXT = 'render.next';
|
|
4659
4726
|
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
leafList.add(leaf.parent);
|
|
4685
|
-
leaf = leaf.parent;
|
|
4727
|
+
class LeaferEvent extends Event {
|
|
4728
|
+
}
|
|
4729
|
+
LeaferEvent.START = 'leafer.start';
|
|
4730
|
+
LeaferEvent.BEFORE_READY = 'leafer.before_ready';
|
|
4731
|
+
LeaferEvent.READY = 'leafer.ready';
|
|
4732
|
+
LeaferEvent.AFTER_READY = 'leafer.after_ready';
|
|
4733
|
+
LeaferEvent.VIEW_READY = 'leafer.view_ready';
|
|
4734
|
+
LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
|
|
4735
|
+
LeaferEvent.STOP = 'leafer.stop';
|
|
4736
|
+
LeaferEvent.RESTART = 'leafer.restart';
|
|
4737
|
+
LeaferEvent.END = 'leafer.end';
|
|
4738
|
+
|
|
4739
|
+
const LeafDataProxy = {
|
|
4740
|
+
__setAttr(name, newValue) {
|
|
4741
|
+
if (this.leafer && this.leafer.created) {
|
|
4742
|
+
const oldValue = this.__.__getInput(name);
|
|
4743
|
+
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4744
|
+
this.__[name] = newValue;
|
|
4745
|
+
if (this.__proxyData)
|
|
4746
|
+
this.setProxyAttr(name, newValue);
|
|
4747
|
+
const { CHANGE } = PropertyEvent;
|
|
4748
|
+
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4749
|
+
if (this.isLeafer) {
|
|
4750
|
+
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
4686
4751
|
}
|
|
4687
4752
|
else {
|
|
4688
|
-
|
|
4753
|
+
if (this.hasEvent(CHANGE))
|
|
4754
|
+
this.emitEvent(event);
|
|
4689
4755
|
}
|
|
4756
|
+
this.leafer.emitEvent(event);
|
|
4690
4757
|
}
|
|
4691
4758
|
}
|
|
4692
4759
|
else {
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
}
|
|
4697
|
-
}
|
|
4698
|
-
},
|
|
4699
|
-
pushAllBranchStack(branch, pushList) {
|
|
4700
|
-
let start = pushList.length;
|
|
4701
|
-
const { children } = branch;
|
|
4702
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4703
|
-
if (children[i].isBranch) {
|
|
4704
|
-
pushList.push(children[i]);
|
|
4705
|
-
}
|
|
4706
|
-
}
|
|
4707
|
-
for (let i = start, len = pushList.length; i < len; i++) {
|
|
4708
|
-
pushAllBranchStack(pushList[i], pushList);
|
|
4760
|
+
this.__[name] = newValue;
|
|
4761
|
+
if (this.__proxyData)
|
|
4762
|
+
this.setProxyAttr(name, newValue);
|
|
4709
4763
|
}
|
|
4710
4764
|
},
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
},
|
|
4716
|
-
updateBoundsByBranchStack(branchStack, exclude) {
|
|
4717
|
-
let branch, children;
|
|
4718
|
-
for (let i = branchStack.length - 1; i > -1; i--) {
|
|
4719
|
-
branch = branchStack[i];
|
|
4720
|
-
children = branch.children;
|
|
4721
|
-
for (let j = 0, len = children.length; j < len; j++) {
|
|
4722
|
-
updateBounds$2(children[j]);
|
|
4723
|
-
}
|
|
4724
|
-
if (exclude && exclude === branch)
|
|
4725
|
-
continue;
|
|
4726
|
-
updateBounds$2(branch);
|
|
4727
|
-
}
|
|
4765
|
+
__getAttr(name) {
|
|
4766
|
+
if (this.__proxyData)
|
|
4767
|
+
return this.getProxyAttr(name);
|
|
4768
|
+
return this.__.__get(name);
|
|
4728
4769
|
}
|
|
4729
4770
|
};
|
|
4730
|
-
const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
|
|
4731
4771
|
|
|
4732
|
-
const
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4772
|
+
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4773
|
+
const { toPoint, tempPoint } = AroundHelper;
|
|
4774
|
+
const LeafMatrix = {
|
|
4775
|
+
__updateWorldMatrix() {
|
|
4776
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4777
|
+
},
|
|
4778
|
+
__updateLocalMatrix() {
|
|
4779
|
+
if (this.__local) {
|
|
4780
|
+
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4781
|
+
if (layout.affectScaleOrRotation) {
|
|
4782
|
+
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4783
|
+
setLayout(local, data, null, layout.affectRotation);
|
|
4784
|
+
layout.scaleChanged = layout.rotationChanged = false;
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4787
|
+
local.e = data.x;
|
|
4788
|
+
local.f = data.y;
|
|
4789
|
+
if (data.around) {
|
|
4790
|
+
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4791
|
+
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4738
4792
|
}
|
|
4739
|
-
wait.length === len ? wait.length = 0 : wait.splice(0, len);
|
|
4740
4793
|
}
|
|
4794
|
+
this.__layout.matrixChanged = false;
|
|
4741
4795
|
}
|
|
4742
4796
|
};
|
|
4743
4797
|
|
|
@@ -4954,7 +5008,7 @@ var LeaferUI = (function (exports) {
|
|
|
4954
5008
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
4955
5009
|
const { toOuterOf } = BoundsHelper;
|
|
4956
5010
|
const { tempToOuterOf, copy: copy$4 } = PointHelper;
|
|
4957
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, transform, setTransform, drop } = LeafHelper;
|
|
5011
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getRelativeWorld, drop } = LeafHelper;
|
|
4958
5012
|
exports.Leaf = class Leaf {
|
|
4959
5013
|
get tag() { return this.__tag; }
|
|
4960
5014
|
set tag(_value) { }
|
|
@@ -4992,21 +5046,31 @@ var LeaferUI = (function (exports) {
|
|
|
4992
5046
|
this.__layout = new this.__LayoutProcessor(this);
|
|
4993
5047
|
if (this.__level)
|
|
4994
5048
|
this.resetCustom();
|
|
4995
|
-
if (data)
|
|
5049
|
+
if (data) {
|
|
5050
|
+
if (data.__)
|
|
5051
|
+
data = data.toJSON();
|
|
4996
5052
|
data.children ? this.set(data) : Object.assign(this, data);
|
|
5053
|
+
}
|
|
4997
5054
|
}
|
|
4998
5055
|
resetCustom() {
|
|
4999
5056
|
this.__hasMask = this.__hasEraser = null;
|
|
5000
5057
|
this.forceUpdate();
|
|
5001
5058
|
}
|
|
5002
|
-
waitParent(item) {
|
|
5059
|
+
waitParent(item, bind) {
|
|
5060
|
+
if (bind)
|
|
5061
|
+
item = item.bind(bind);
|
|
5003
5062
|
this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
|
|
5004
5063
|
}
|
|
5005
|
-
waitLeafer(item) {
|
|
5064
|
+
waitLeafer(item, bind) {
|
|
5065
|
+
if (bind)
|
|
5066
|
+
item = item.bind(bind);
|
|
5006
5067
|
this.leafer ? item() : (this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item]);
|
|
5007
5068
|
}
|
|
5008
|
-
nextRender(item, off) {
|
|
5009
|
-
this.leafer ? this.leafer.nextRender(item, off) : this.waitLeafer(() => this.leafer.nextRender(item, off));
|
|
5069
|
+
nextRender(item, bind, off) {
|
|
5070
|
+
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
5071
|
+
}
|
|
5072
|
+
removeNextRender(item) {
|
|
5073
|
+
this.nextRender(item, null, 'off');
|
|
5010
5074
|
}
|
|
5011
5075
|
__bindLeafer(leafer) {
|
|
5012
5076
|
if (this.isLeafer) {
|
|
@@ -5043,6 +5107,7 @@ var LeaferUI = (function (exports) {
|
|
|
5043
5107
|
getProxyAttr(_attrName) { return undefined; }
|
|
5044
5108
|
find(_condition, _options) { return undefined; }
|
|
5045
5109
|
findOne(_condition, _options) { return undefined; }
|
|
5110
|
+
focus(_value) { }
|
|
5046
5111
|
forceUpdate(attrName) {
|
|
5047
5112
|
if (attrName === undefined)
|
|
5048
5113
|
attrName = 'width';
|
|
@@ -5098,6 +5163,9 @@ var LeaferUI = (function (exports) {
|
|
|
5098
5163
|
return this.__world.f;
|
|
5099
5164
|
return this.getLayoutBounds()[attrName];
|
|
5100
5165
|
}
|
|
5166
|
+
getTransform(relative) {
|
|
5167
|
+
return this.__layout.getTransform(relative || 'local');
|
|
5168
|
+
}
|
|
5101
5169
|
getBounds(type, relative) {
|
|
5102
5170
|
return this.__layout.getBounds(type, relative);
|
|
5103
5171
|
}
|
|
@@ -5107,6 +5175,12 @@ var LeaferUI = (function (exports) {
|
|
|
5107
5175
|
getLayoutPoints(type, relative) {
|
|
5108
5176
|
return this.__layout.getLayoutPoints(type, relative);
|
|
5109
5177
|
}
|
|
5178
|
+
getWorldBounds(inner, relative, change) {
|
|
5179
|
+
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
5180
|
+
const to = change ? inner : {};
|
|
5181
|
+
toOuterOf(inner, matrix, to);
|
|
5182
|
+
return to;
|
|
5183
|
+
}
|
|
5110
5184
|
worldToLocal(world, to, distance, relative) {
|
|
5111
5185
|
if (this.parent) {
|
|
5112
5186
|
this.parent.worldToInner(world, to, distance, relative);
|
|
@@ -5189,6 +5263,21 @@ var LeaferUI = (function (exports) {
|
|
|
5189
5263
|
skewOf(origin, skewX, skewY, resize) {
|
|
5190
5264
|
skewOfLocal(this, tempToOuterOf(origin, this.localTransform), skewX, skewY, resize);
|
|
5191
5265
|
}
|
|
5266
|
+
transformWorld(worldTransform, resize) {
|
|
5267
|
+
transformWorld(this, worldTransform, resize);
|
|
5268
|
+
}
|
|
5269
|
+
moveWorld(x, y) {
|
|
5270
|
+
moveWorld(this, x, y);
|
|
5271
|
+
}
|
|
5272
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
|
|
5273
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
|
|
5274
|
+
}
|
|
5275
|
+
rotateOfWorld(worldOrigin, rotation) {
|
|
5276
|
+
rotateOfWorld(this, worldOrigin, rotation);
|
|
5277
|
+
}
|
|
5278
|
+
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5279
|
+
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5280
|
+
}
|
|
5192
5281
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5193
5282
|
this.scaleX *= scaleX;
|
|
5194
5283
|
this.scaleY *= scaleY;
|
|
@@ -5320,7 +5409,8 @@ var LeaferUI = (function (exports) {
|
|
|
5320
5409
|
index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5321
5410
|
if (child.isBranch)
|
|
5322
5411
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5323
|
-
child.__layout.
|
|
5412
|
+
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5413
|
+
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5324
5414
|
if (child.__parentWait)
|
|
5325
5415
|
WaitHelper.run(child.__parentWait);
|
|
5326
5416
|
if (this.leafer) {
|
|
@@ -6180,6 +6270,10 @@ var LeaferUI = (function (exports) {
|
|
|
6180
6270
|
}
|
|
6181
6271
|
else {
|
|
6182
6272
|
this.requestLayout();
|
|
6273
|
+
if (this.ignore) {
|
|
6274
|
+
this.ignore = this.rendering = false;
|
|
6275
|
+
return;
|
|
6276
|
+
}
|
|
6183
6277
|
this.emitRender(RenderEvent.BEFORE);
|
|
6184
6278
|
if (this.config.usePartRender && this.totalTimes > 1) {
|
|
6185
6279
|
this.partRender();
|
|
@@ -6327,9 +6421,7 @@ var LeaferUI = (function (exports) {
|
|
|
6327
6421
|
if (this.target) {
|
|
6328
6422
|
this.stop();
|
|
6329
6423
|
this.__removeListenEvents();
|
|
6330
|
-
this.target = null;
|
|
6331
|
-
this.canvas = null;
|
|
6332
|
-
this.config = null;
|
|
6424
|
+
this.target = this.canvas = this.config = null;
|
|
6333
6425
|
}
|
|
6334
6426
|
}
|
|
6335
6427
|
}
|
|
@@ -6586,14 +6678,36 @@ var LeaferUI = (function (exports) {
|
|
|
6586
6678
|
});
|
|
6587
6679
|
Platform.layout = Layouter.fullLayout;
|
|
6588
6680
|
|
|
6681
|
+
const TextConvert = {};
|
|
6682
|
+
const ColorConvert = {};
|
|
6683
|
+
const PathArrow = {};
|
|
6684
|
+
const Paint = {};
|
|
6685
|
+
const PaintImage = {};
|
|
6686
|
+
const PaintGradient = {};
|
|
6687
|
+
const Effect = {};
|
|
6688
|
+
const Export = {};
|
|
6689
|
+
const State = {};
|
|
6690
|
+
|
|
6691
|
+
function stateType(defaultValue) {
|
|
6692
|
+
return (target, key) => {
|
|
6693
|
+
const stateType = key + 'Style';
|
|
6694
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
6695
|
+
set(value) {
|
|
6696
|
+
this.__setAttr(key, value);
|
|
6697
|
+
this.waitLeafer(() => { if (State.setStyle)
|
|
6698
|
+
State.setStyle(this, stateType, value); });
|
|
6699
|
+
}
|
|
6700
|
+
});
|
|
6701
|
+
};
|
|
6702
|
+
}
|
|
6589
6703
|
function arrowType(defaultValue) {
|
|
6590
6704
|
return (target, key) => {
|
|
6591
6705
|
defineLeafAttr(target, key, defaultValue, {
|
|
6592
6706
|
set(value) {
|
|
6593
6707
|
this.__setAttr(key, value);
|
|
6594
|
-
doStrokeType(this);
|
|
6595
6708
|
const data = this.__;
|
|
6596
6709
|
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6710
|
+
doStrokeType(this);
|
|
6597
6711
|
}
|
|
6598
6712
|
});
|
|
6599
6713
|
};
|
|
@@ -6621,15 +6735,16 @@ var LeaferUI = (function (exports) {
|
|
|
6621
6735
|
});
|
|
6622
6736
|
};
|
|
6623
6737
|
}
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6738
|
+
function zoomLayerType() {
|
|
6739
|
+
return (target, key) => {
|
|
6740
|
+
const privateKey = '_' + key;
|
|
6741
|
+
defineKey(target, key, {
|
|
6742
|
+
set(value) { if (this.isLeafer)
|
|
6743
|
+
this[privateKey] = value; },
|
|
6744
|
+
get() { return this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer; }
|
|
6745
|
+
});
|
|
6746
|
+
};
|
|
6747
|
+
}
|
|
6633
6748
|
|
|
6634
6749
|
const { parse } = PathConvert;
|
|
6635
6750
|
const emptyPaint = {};
|
|
@@ -6638,7 +6753,7 @@ var LeaferUI = (function (exports) {
|
|
|
6638
6753
|
get __strokeWidth() {
|
|
6639
6754
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6640
6755
|
if (strokeWidthFixed) {
|
|
6641
|
-
let { scaleX } = this.__leaf.
|
|
6756
|
+
let { scaleX } = this.__leaf.__nowWorld;
|
|
6642
6757
|
if (scaleX < 0)
|
|
6643
6758
|
scaleX = -scaleX;
|
|
6644
6759
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
@@ -6912,18 +7027,11 @@ var LeaferUI = (function (exports) {
|
|
|
6912
7027
|
}
|
|
6913
7028
|
},
|
|
6914
7029
|
__drawFast(canvas, options) {
|
|
6915
|
-
|
|
6916
|
-
this.__drawRenderPath(canvas);
|
|
6917
|
-
if (fill)
|
|
6918
|
-
Paint.fill(fill, this, canvas);
|
|
6919
|
-
if (__drawAfterFill)
|
|
6920
|
-
this.__drawAfterFill(canvas, options);
|
|
6921
|
-
if (stroke)
|
|
6922
|
-
Paint.stroke(stroke, this, canvas);
|
|
7030
|
+
drawFast(this, canvas, options);
|
|
6923
7031
|
},
|
|
6924
7032
|
__draw(canvas, options) {
|
|
6925
|
-
|
|
6926
|
-
|
|
7033
|
+
const data = this.__;
|
|
7034
|
+
if (data.__complex) {
|
|
6927
7035
|
if (data.__needComputePaint)
|
|
6928
7036
|
data.__computePaint();
|
|
6929
7037
|
const { fill, stroke, __drawAfterFill } = data;
|
|
@@ -6956,7 +7064,12 @@ var LeaferUI = (function (exports) {
|
|
|
6956
7064
|
}
|
|
6957
7065
|
}
|
|
6958
7066
|
else {
|
|
6959
|
-
|
|
7067
|
+
if (data.__pathInputed) {
|
|
7068
|
+
drawFast(this, canvas, options);
|
|
7069
|
+
}
|
|
7070
|
+
else {
|
|
7071
|
+
this.__drawFast(canvas, options);
|
|
7072
|
+
}
|
|
6960
7073
|
}
|
|
6961
7074
|
},
|
|
6962
7075
|
__renderShape(canvas, options) {
|
|
@@ -6971,6 +7084,16 @@ var LeaferUI = (function (exports) {
|
|
|
6971
7084
|
}
|
|
6972
7085
|
}
|
|
6973
7086
|
};
|
|
7087
|
+
function drawFast(ui, canvas, options) {
|
|
7088
|
+
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
7089
|
+
ui.__drawRenderPath(canvas);
|
|
7090
|
+
if (fill)
|
|
7091
|
+
Paint.fill(fill, ui, canvas);
|
|
7092
|
+
if (__drawAfterFill)
|
|
7093
|
+
ui.__drawAfterFill(canvas, options);
|
|
7094
|
+
if (stroke)
|
|
7095
|
+
Paint.stroke(stroke, ui, canvas);
|
|
7096
|
+
}
|
|
6974
7097
|
|
|
6975
7098
|
const RectRender = {
|
|
6976
7099
|
__drawFast(canvas, options) {
|
|
@@ -7019,6 +7142,10 @@ var LeaferUI = (function (exports) {
|
|
|
7019
7142
|
const { scaleX, scaleY } = this;
|
|
7020
7143
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7021
7144
|
}
|
|
7145
|
+
get pen() {
|
|
7146
|
+
pen.set(this.path = this.__.path || []);
|
|
7147
|
+
return pen;
|
|
7148
|
+
}
|
|
7022
7149
|
constructor(data) {
|
|
7023
7150
|
super(data);
|
|
7024
7151
|
}
|
|
@@ -7027,7 +7154,7 @@ var LeaferUI = (function (exports) {
|
|
|
7027
7154
|
Object.assign(this, data);
|
|
7028
7155
|
}
|
|
7029
7156
|
get(name) {
|
|
7030
|
-
return name ? this.__.__getInput(name) : this.__.__getInputData();
|
|
7157
|
+
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
7031
7158
|
}
|
|
7032
7159
|
createProxyData() { return undefined; }
|
|
7033
7160
|
find(_condition, _options) { return undefined; }
|
|
@@ -7036,10 +7163,11 @@ var LeaferUI = (function (exports) {
|
|
|
7036
7163
|
this.__layout.update();
|
|
7037
7164
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7038
7165
|
if (!path) {
|
|
7039
|
-
path = [];
|
|
7040
7166
|
const { width, height } = this.boxBounds;
|
|
7041
|
-
if (width || height)
|
|
7042
|
-
|
|
7167
|
+
if (width || height) {
|
|
7168
|
+
pen.set(path = []);
|
|
7169
|
+
this.__drawPathByBox(pen);
|
|
7170
|
+
}
|
|
7043
7171
|
}
|
|
7044
7172
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7045
7173
|
}
|
|
@@ -7111,6 +7239,9 @@ var LeaferUI = (function (exports) {
|
|
|
7111
7239
|
__decorate([
|
|
7112
7240
|
dataProcessor(UIData)
|
|
7113
7241
|
], exports.UI.prototype, "__", void 0);
|
|
7242
|
+
__decorate([
|
|
7243
|
+
zoomLayerType()
|
|
7244
|
+
], exports.UI.prototype, "zoomLayer", void 0);
|
|
7114
7245
|
__decorate([
|
|
7115
7246
|
dataType('')
|
|
7116
7247
|
], exports.UI.prototype, "id", void 0);
|
|
@@ -7129,6 +7260,12 @@ var LeaferUI = (function (exports) {
|
|
|
7129
7260
|
__decorate([
|
|
7130
7261
|
opacityType(true)
|
|
7131
7262
|
], exports.UI.prototype, "visible", void 0);
|
|
7263
|
+
__decorate([
|
|
7264
|
+
stateType(false)
|
|
7265
|
+
], exports.UI.prototype, "selected", void 0);
|
|
7266
|
+
__decorate([
|
|
7267
|
+
stateType(false)
|
|
7268
|
+
], exports.UI.prototype, "disabled", void 0);
|
|
7132
7269
|
__decorate([
|
|
7133
7270
|
dataType(false)
|
|
7134
7271
|
], exports.UI.prototype, "locked", void 0);
|
|
@@ -7276,6 +7413,24 @@ var LeaferUI = (function (exports) {
|
|
|
7276
7413
|
__decorate([
|
|
7277
7414
|
effectType()
|
|
7278
7415
|
], exports.UI.prototype, "grayscale", void 0);
|
|
7416
|
+
__decorate([
|
|
7417
|
+
dataType()
|
|
7418
|
+
], exports.UI.prototype, "normalStyle", void 0);
|
|
7419
|
+
__decorate([
|
|
7420
|
+
dataType()
|
|
7421
|
+
], exports.UI.prototype, "hoverStyle", void 0);
|
|
7422
|
+
__decorate([
|
|
7423
|
+
dataType()
|
|
7424
|
+
], exports.UI.prototype, "pressStyle", void 0);
|
|
7425
|
+
__decorate([
|
|
7426
|
+
dataType()
|
|
7427
|
+
], exports.UI.prototype, "focusStyle", void 0);
|
|
7428
|
+
__decorate([
|
|
7429
|
+
dataType()
|
|
7430
|
+
], exports.UI.prototype, "selectedStyle", void 0);
|
|
7431
|
+
__decorate([
|
|
7432
|
+
dataType()
|
|
7433
|
+
], exports.UI.prototype, "disabledStyle", void 0);
|
|
7279
7434
|
__decorate([
|
|
7280
7435
|
rewrite(exports.Leaf.prototype.reset)
|
|
7281
7436
|
], exports.UI.prototype, "reset", null);
|
|
@@ -7312,7 +7467,7 @@ var LeaferUI = (function (exports) {
|
|
|
7312
7467
|
super.set(data);
|
|
7313
7468
|
let child;
|
|
7314
7469
|
children.forEach(childData => {
|
|
7315
|
-
child = UICreator.get(childData.tag, childData);
|
|
7470
|
+
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
7316
7471
|
this.add(child);
|
|
7317
7472
|
});
|
|
7318
7473
|
data.children = children;
|
|
@@ -7361,7 +7516,6 @@ var LeaferUI = (function (exports) {
|
|
|
7361
7516
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7362
7517
|
constructor(userConfig, data) {
|
|
7363
7518
|
super(data);
|
|
7364
|
-
this.zoomLayer = this;
|
|
7365
7519
|
this.config = {
|
|
7366
7520
|
type: 'design',
|
|
7367
7521
|
start: true,
|
|
@@ -7374,7 +7528,6 @@ var LeaferUI = (function (exports) {
|
|
|
7374
7528
|
move: {
|
|
7375
7529
|
holdSpaceKey: true,
|
|
7376
7530
|
holdMiddleKey: true,
|
|
7377
|
-
dragOut: true,
|
|
7378
7531
|
autoDistance: 2
|
|
7379
7532
|
}
|
|
7380
7533
|
};
|
|
@@ -7505,9 +7658,6 @@ var LeaferUI = (function (exports) {
|
|
|
7505
7658
|
this.leafer = leafer;
|
|
7506
7659
|
this.__level = 1;
|
|
7507
7660
|
}
|
|
7508
|
-
setZoomLayer(zoomLayer) {
|
|
7509
|
-
this.zoomLayer = zoomLayer;
|
|
7510
|
-
}
|
|
7511
7661
|
__checkAutoLayout(config) {
|
|
7512
7662
|
if (!config.width || !config.height) {
|
|
7513
7663
|
this.autoLayout = new AutoBounds(config);
|
|
@@ -7593,13 +7743,19 @@ var LeaferUI = (function (exports) {
|
|
|
7593
7743
|
this.nextRender(() => this.interaction.updateCursor());
|
|
7594
7744
|
}
|
|
7595
7745
|
}
|
|
7596
|
-
waitReady(item) {
|
|
7746
|
+
waitReady(item, bind) {
|
|
7747
|
+
if (bind)
|
|
7748
|
+
item = item.bind(bind);
|
|
7597
7749
|
this.ready ? item() : this.__readyWait.push(item);
|
|
7598
7750
|
}
|
|
7599
|
-
waitViewReady(item) {
|
|
7751
|
+
waitViewReady(item, bind) {
|
|
7752
|
+
if (bind)
|
|
7753
|
+
item = item.bind(bind);
|
|
7600
7754
|
this.viewReady ? item() : this.__viewReadyWait.push(item);
|
|
7601
7755
|
}
|
|
7602
|
-
waitViewCompleted(item) {
|
|
7756
|
+
waitViewCompleted(item, bind) {
|
|
7757
|
+
if (bind)
|
|
7758
|
+
item = item.bind(bind);
|
|
7603
7759
|
this.__viewCompletedWait.push(item);
|
|
7604
7760
|
if (this.viewCompleted) {
|
|
7605
7761
|
this.__checkViewCompleted(false);
|
|
@@ -7609,7 +7765,9 @@ var LeaferUI = (function (exports) {
|
|
|
7609
7765
|
this.start();
|
|
7610
7766
|
}
|
|
7611
7767
|
}
|
|
7612
|
-
nextRender(item, off) {
|
|
7768
|
+
nextRender(item, bind, off) {
|
|
7769
|
+
if (bind)
|
|
7770
|
+
item = item.bind(bind);
|
|
7613
7771
|
const list = this.__nextRenderWait;
|
|
7614
7772
|
if (off) {
|
|
7615
7773
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -7623,6 +7781,15 @@ var LeaferUI = (function (exports) {
|
|
|
7623
7781
|
list.push(item);
|
|
7624
7782
|
}
|
|
7625
7783
|
}
|
|
7784
|
+
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7785
|
+
validScale(changeScale) {
|
|
7786
|
+
const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
7787
|
+
if (absScale < min)
|
|
7788
|
+
changeScale = min / scaleX;
|
|
7789
|
+
else if (absScale > max)
|
|
7790
|
+
changeScale = max / scaleX;
|
|
7791
|
+
return changeScale;
|
|
7792
|
+
}
|
|
7626
7793
|
__checkUpdateLayout() {
|
|
7627
7794
|
this.__layout.update();
|
|
7628
7795
|
}
|
|
@@ -8695,17 +8862,21 @@ var LeaferUI = (function (exports) {
|
|
|
8695
8862
|
function design(leafer) {
|
|
8696
8863
|
if (leafer.isApp)
|
|
8697
8864
|
return;
|
|
8698
|
-
leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, (e) =>
|
|
8865
|
+
leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, (e) => {
|
|
8866
|
+
let { moveX, moveY } = e;
|
|
8867
|
+
if (leafer.config.move.scroll) {
|
|
8868
|
+
if (Math.abs(moveX) > Math.abs(moveY))
|
|
8869
|
+
moveY = 0;
|
|
8870
|
+
else
|
|
8871
|
+
moveX = 0;
|
|
8872
|
+
}
|
|
8873
|
+
leafer.zoomLayer.move(moveX, moveY);
|
|
8874
|
+
}), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, (e) => {
|
|
8699
8875
|
const { zoomLayer } = leafer;
|
|
8700
|
-
const
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
scale =
|
|
8704
|
-
else if (absScale > max)
|
|
8705
|
-
scale = max / scaleX;
|
|
8706
|
-
if (scale !== 1) {
|
|
8707
|
-
PointHelper.scaleOf(zoomLayer, e, scale);
|
|
8708
|
-
zoomLayer.scale = scaleX * scale;
|
|
8876
|
+
const changeScale = leafer.validScale(e.scale);
|
|
8877
|
+
if (changeScale !== 1) {
|
|
8878
|
+
PointHelper.scaleOf(zoomLayer, e, changeScale);
|
|
8879
|
+
zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
|
|
8709
8880
|
}
|
|
8710
8881
|
}));
|
|
8711
8882
|
}
|
|
@@ -8749,6 +8920,7 @@ var LeaferUI = (function (exports) {
|
|
|
8749
8920
|
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
8750
8921
|
data.path = path;
|
|
8751
8922
|
this.moveData = Object.assign(Object.assign({}, data), { moveX: 0, moveY: 0 });
|
|
8923
|
+
interaction.cancelHover();
|
|
8752
8924
|
interaction.emit(exports.MoveEvent.START, this.moveData);
|
|
8753
8925
|
}
|
|
8754
8926
|
data.path = this.moveData.path;
|
|
@@ -8762,6 +8934,7 @@ var LeaferUI = (function (exports) {
|
|
|
8762
8934
|
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
8763
8935
|
data.path = path;
|
|
8764
8936
|
this.zoomData = Object.assign(Object.assign({}, data), { scale: 1 });
|
|
8937
|
+
interaction.cancelHover();
|
|
8765
8938
|
interaction.emit(exports.ZoomEvent.START, this.zoomData);
|
|
8766
8939
|
}
|
|
8767
8940
|
data.path = this.zoomData.path;
|
|
@@ -8775,6 +8948,7 @@ var LeaferUI = (function (exports) {
|
|
|
8775
8948
|
const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
|
|
8776
8949
|
data.path = path;
|
|
8777
8950
|
this.rotateData = Object.assign(Object.assign({}, data), { rotation: 0 });
|
|
8951
|
+
interaction.cancelHover();
|
|
8778
8952
|
interaction.emit(exports.RotateEvent.START, this.rotateData);
|
|
8779
8953
|
}
|
|
8780
8954
|
data.path = this.rotateData.path;
|
|
@@ -8892,6 +9066,7 @@ var LeaferUI = (function (exports) {
|
|
|
8892
9066
|
this.dragEndReal();
|
|
8893
9067
|
this.downData = this.interaction.downData;
|
|
8894
9068
|
this.dragData = getDragEventData(data, data, data);
|
|
9069
|
+
this.canAnimate = this.canDragOut = true;
|
|
8895
9070
|
}
|
|
8896
9071
|
getList() {
|
|
8897
9072
|
const { proxy } = this.interaction.selector;
|
|
@@ -8904,9 +9079,6 @@ var LeaferUI = (function (exports) {
|
|
|
8904
9079
|
interaction.pointerCancel();
|
|
8905
9080
|
return;
|
|
8906
9081
|
}
|
|
8907
|
-
else {
|
|
8908
|
-
this.canAnimate = true;
|
|
8909
|
-
}
|
|
8910
9082
|
if (!this.moving && canDrag) {
|
|
8911
9083
|
if (this.moving = interaction.moveMode || interaction.isHoldRightKey)
|
|
8912
9084
|
interaction.emit(exports.MoveEvent.START, this.dragData);
|
|
@@ -8957,13 +9129,14 @@ var LeaferUI = (function (exports) {
|
|
|
8957
9129
|
const list = this.getList();
|
|
8958
9130
|
if (list.length && running) {
|
|
8959
9131
|
const { moveX, moveY } = this.dragData;
|
|
8960
|
-
list.forEach(leaf =>
|
|
9132
|
+
list.forEach(leaf => leaf.moveWorld(moveX, moveY));
|
|
8961
9133
|
}
|
|
8962
9134
|
}
|
|
8963
9135
|
dragOverOrOut(data) {
|
|
8964
9136
|
const { interaction } = this;
|
|
8965
9137
|
const { dragOverPath } = this;
|
|
8966
9138
|
const { path } = data;
|
|
9139
|
+
this.dragOverPath = path;
|
|
8967
9140
|
if (dragOverPath) {
|
|
8968
9141
|
if (path.indexAt(0) !== dragOverPath.indexAt(0)) {
|
|
8969
9142
|
interaction.emit(exports.DragEvent.OUT, data, dragOverPath);
|
|
@@ -8973,7 +9146,6 @@ var LeaferUI = (function (exports) {
|
|
|
8973
9146
|
else {
|
|
8974
9147
|
interaction.emit(exports.DragEvent.OVER, data, path);
|
|
8975
9148
|
}
|
|
8976
|
-
this.dragOverPath = path;
|
|
8977
9149
|
}
|
|
8978
9150
|
dragEnterOrLeave(data) {
|
|
8979
9151
|
const { interaction } = this;
|
|
@@ -8987,7 +9159,7 @@ var LeaferUI = (function (exports) {
|
|
|
8987
9159
|
if (!this.dragData)
|
|
8988
9160
|
return;
|
|
8989
9161
|
const { moveX, moveY } = this.dragData;
|
|
8990
|
-
if (this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
|
|
9162
|
+
if (this.interaction.config.move.dragAnimate && this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
|
|
8991
9163
|
data = Object.assign({}, data);
|
|
8992
9164
|
speed = (speed || (data.pointerType === 'touch' ? 2 : 1)) * 0.9;
|
|
8993
9165
|
PointHelper.move(data, moveX * speed, moveY * speed);
|
|
@@ -9021,12 +9193,11 @@ var LeaferUI = (function (exports) {
|
|
|
9021
9193
|
animate(func, off) {
|
|
9022
9194
|
const animateWait = func || this.animateWait;
|
|
9023
9195
|
if (animateWait)
|
|
9024
|
-
this.interaction.target.nextRender(animateWait, off);
|
|
9196
|
+
this.interaction.target.nextRender(animateWait, null, off);
|
|
9025
9197
|
this.animateWait = func;
|
|
9026
9198
|
}
|
|
9027
9199
|
swipe(data, endDragData) {
|
|
9028
|
-
const { interaction } = this;
|
|
9029
|
-
const { downData } = interaction;
|
|
9200
|
+
const { interaction, downData } = this;
|
|
9030
9201
|
if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
|
|
9031
9202
|
const swipeData = getSwipeEventData(downData, this.dragData, endDragData);
|
|
9032
9203
|
this.interaction.emit(swipeData.type, swipeData);
|
|
@@ -9049,9 +9220,9 @@ var LeaferUI = (function (exports) {
|
|
|
9049
9220
|
this.autoMoveOnDragOut(data);
|
|
9050
9221
|
}
|
|
9051
9222
|
autoMoveOnDragOut(data) {
|
|
9052
|
-
const { interaction, downData } = this;
|
|
9223
|
+
const { interaction, downData, canDragOut } = this;
|
|
9053
9224
|
const { autoDistance, dragOut } = interaction.config.move;
|
|
9054
|
-
if (!dragOut || !autoDistance)
|
|
9225
|
+
if (!dragOut || !canDragOut || !autoDistance)
|
|
9055
9226
|
return;
|
|
9056
9227
|
const bounds = interaction.shrinkCanvasBounds;
|
|
9057
9228
|
const { x, y } = bounds;
|
|
@@ -9127,12 +9298,16 @@ var LeaferUI = (function (exports) {
|
|
|
9127
9298
|
function emitEvent(leaf, type, data, capture, excludePath) {
|
|
9128
9299
|
if (leaf.destroyed)
|
|
9129
9300
|
return true;
|
|
9130
|
-
if (leaf.__.hitSelf &&
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
leaf.
|
|
9134
|
-
|
|
9135
|
-
|
|
9301
|
+
if (leaf.__.hitSelf && !exclude(leaf, excludePath)) {
|
|
9302
|
+
if (State.updateEventStyle)
|
|
9303
|
+
State.updateEventStyle(leaf, type);
|
|
9304
|
+
if (leaf.hasEvent(type, capture)) {
|
|
9305
|
+
data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
|
|
9306
|
+
const event = EventCreator.get(type, data);
|
|
9307
|
+
leaf.emitEvent(event, capture);
|
|
9308
|
+
if (event.isStop)
|
|
9309
|
+
return true;
|
|
9310
|
+
}
|
|
9136
9311
|
}
|
|
9137
9312
|
return false;
|
|
9138
9313
|
}
|
|
@@ -9157,7 +9332,6 @@ var LeaferUI = (function (exports) {
|
|
|
9157
9332
|
|
|
9158
9333
|
const config = {
|
|
9159
9334
|
wheel: {
|
|
9160
|
-
zoomMode: false,
|
|
9161
9335
|
zoomSpeed: 0.5,
|
|
9162
9336
|
moveSpeed: 0.5,
|
|
9163
9337
|
rotateSpeed: 0.5,
|
|
@@ -9166,14 +9340,12 @@ var LeaferUI = (function (exports) {
|
|
|
9166
9340
|
},
|
|
9167
9341
|
pointer: {
|
|
9168
9342
|
hitRadius: 5,
|
|
9169
|
-
through: false,
|
|
9170
9343
|
tapTime: 120,
|
|
9171
9344
|
longPressTime: 800,
|
|
9172
9345
|
transformTime: 500,
|
|
9173
9346
|
dragHover: true,
|
|
9174
9347
|
dragDistance: 2,
|
|
9175
9348
|
swipeDistance: 20,
|
|
9176
|
-
ignoreMove: false,
|
|
9177
9349
|
preventDefaultMenu: true
|
|
9178
9350
|
},
|
|
9179
9351
|
cursor: {}
|
|
@@ -9216,17 +9388,19 @@ var LeaferUI = (function (exports) {
|
|
|
9216
9388
|
this.updateDownData(data);
|
|
9217
9389
|
if (useDefaultPath)
|
|
9218
9390
|
data.path = this.defaultPath;
|
|
9219
|
-
this.emit(exports.PointerEvent.BEFORE_DOWN, data);
|
|
9220
|
-
this.emit(exports.PointerEvent.DOWN, data);
|
|
9221
9391
|
this.downTime = Date.now();
|
|
9222
|
-
this.
|
|
9223
|
-
|
|
9224
|
-
this.
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9392
|
+
if (this.downed = !this.moveMode) {
|
|
9393
|
+
this.emit(exports.PointerEvent.BEFORE_DOWN, data);
|
|
9394
|
+
this.emit(exports.PointerEvent.DOWN, data);
|
|
9395
|
+
if (PointerButton.left(data)) {
|
|
9396
|
+
this.tapWait();
|
|
9397
|
+
this.longPressWait(data);
|
|
9398
|
+
}
|
|
9399
|
+
else if (PointerButton.right(data)) {
|
|
9400
|
+
this.waitMenuTap = true;
|
|
9401
|
+
}
|
|
9229
9402
|
}
|
|
9403
|
+
this.dragger.setDragData(data);
|
|
9230
9404
|
this.updateCursor(data);
|
|
9231
9405
|
}
|
|
9232
9406
|
pointerMove(data) {
|
|
@@ -9234,14 +9408,18 @@ var LeaferUI = (function (exports) {
|
|
|
9234
9408
|
data = this.hoverData;
|
|
9235
9409
|
if (!data)
|
|
9236
9410
|
return;
|
|
9237
|
-
|
|
9411
|
+
const { downData } = this;
|
|
9412
|
+
if (downData)
|
|
9238
9413
|
PointerButton.defaultLeft(data);
|
|
9239
9414
|
const hit = this.canvas.bounds.hitPoint(data);
|
|
9240
|
-
if (hit ||
|
|
9241
|
-
if (hit && !
|
|
9415
|
+
if (hit || downData) {
|
|
9416
|
+
if (hit && !downData && PointerButton.left(data)) {
|
|
9242
9417
|
this.pointerDown(data, true);
|
|
9418
|
+
this.dragger.canDragOut = false;
|
|
9419
|
+
}
|
|
9243
9420
|
this.pointerMoveReal(data);
|
|
9244
|
-
|
|
9421
|
+
if (downData)
|
|
9422
|
+
this.dragger.checkDragOut(data);
|
|
9245
9423
|
}
|
|
9246
9424
|
}
|
|
9247
9425
|
pointerMoveReal(data) {
|
|
@@ -9257,9 +9435,11 @@ var LeaferUI = (function (exports) {
|
|
|
9257
9435
|
}
|
|
9258
9436
|
if (!this.dragger.moving) {
|
|
9259
9437
|
this.updateHoverData(data);
|
|
9438
|
+
if (this.moveMode)
|
|
9439
|
+
data.path = this.defaultPath;
|
|
9260
9440
|
this.emit(exports.PointerEvent.MOVE, data);
|
|
9261
|
-
this.
|
|
9262
|
-
|
|
9441
|
+
if (!(this.dragging && !this.config.pointer.dragHover))
|
|
9442
|
+
this.pointerHover(data);
|
|
9263
9443
|
if (this.dragger.dragging) {
|
|
9264
9444
|
this.dragger.dragOverOrOut(data);
|
|
9265
9445
|
this.dragger.dragEnterOrLeave(data);
|
|
@@ -9268,20 +9448,24 @@ var LeaferUI = (function (exports) {
|
|
|
9268
9448
|
this.updateCursor(this.downData || data);
|
|
9269
9449
|
}
|
|
9270
9450
|
pointerUp(data) {
|
|
9451
|
+
const { downData, oldDownData } = this;
|
|
9271
9452
|
if (!data)
|
|
9272
|
-
data =
|
|
9273
|
-
if (!
|
|
9453
|
+
data = downData;
|
|
9454
|
+
if (!downData)
|
|
9274
9455
|
return;
|
|
9275
9456
|
PointerButton.defaultLeft(data);
|
|
9276
9457
|
this.findPath(data);
|
|
9277
|
-
this.
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
this.emit(exports.PointerEvent.UP,
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9458
|
+
if (this.downed) {
|
|
9459
|
+
this.downed = false;
|
|
9460
|
+
this.emit(exports.PointerEvent.BEFORE_UP, data);
|
|
9461
|
+
this.emit(exports.PointerEvent.UP, data);
|
|
9462
|
+
if (oldDownData)
|
|
9463
|
+
this.emit(exports.PointerEvent.UP, oldDownData, undefined, data.path);
|
|
9464
|
+
this.emit(exports.PointerEvent.UP, downData, undefined, data.path);
|
|
9465
|
+
this.touchLeave(data);
|
|
9466
|
+
this.tap(data);
|
|
9467
|
+
this.menuTap(data);
|
|
9468
|
+
}
|
|
9285
9469
|
this.dragger.dragEnd(data);
|
|
9286
9470
|
this.downData = this.oldDownData = null;
|
|
9287
9471
|
this.updateCursor(data);
|
|
@@ -9321,8 +9505,10 @@ var LeaferUI = (function (exports) {
|
|
|
9321
9505
|
this.downKeyMap[code] = true;
|
|
9322
9506
|
Keyboard.setDownCode(code);
|
|
9323
9507
|
this.emit(exports.KeyEvent.HOLD, data, this.defaultPath);
|
|
9324
|
-
if (this.moveMode)
|
|
9508
|
+
if (this.moveMode) {
|
|
9509
|
+
this.cancelHover();
|
|
9325
9510
|
this.updateCursor();
|
|
9511
|
+
}
|
|
9326
9512
|
}
|
|
9327
9513
|
this.emit(exports.KeyEvent.DOWN, data, this.defaultPath);
|
|
9328
9514
|
}
|
|
@@ -9334,32 +9520,34 @@ var LeaferUI = (function (exports) {
|
|
|
9334
9520
|
if (this.cursor === 'grab')
|
|
9335
9521
|
this.updateCursor();
|
|
9336
9522
|
}
|
|
9523
|
+
pointerHover(data) {
|
|
9524
|
+
this.pointerOverOrOut(data);
|
|
9525
|
+
this.pointerEnterOrLeave(data);
|
|
9526
|
+
}
|
|
9337
9527
|
pointerOverOrOut(data) {
|
|
9338
|
-
if (this.dragger.moving)
|
|
9339
|
-
return;
|
|
9340
|
-
if (this.dragging && !this.config.pointer.dragHover)
|
|
9341
|
-
return;
|
|
9342
9528
|
const { path } = data;
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9529
|
+
const { overPath } = this;
|
|
9530
|
+
this.overPath = path;
|
|
9531
|
+
if (overPath) {
|
|
9532
|
+
if (path.indexAt(0) !== overPath.indexAt(0)) {
|
|
9533
|
+
this.emit(exports.PointerEvent.OUT, data, overPath);
|
|
9346
9534
|
this.emit(exports.PointerEvent.OVER, data, path);
|
|
9347
9535
|
}
|
|
9348
9536
|
}
|
|
9349
9537
|
else {
|
|
9350
9538
|
this.emit(exports.PointerEvent.OVER, data, path);
|
|
9351
9539
|
}
|
|
9352
|
-
this.overPath = path;
|
|
9353
9540
|
}
|
|
9354
9541
|
pointerEnterOrLeave(data) {
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
this.emit(exports.PointerEvent.ENTER, data, path, this.enterPath);
|
|
9542
|
+
let { path } = data;
|
|
9543
|
+
if (this.downData && !this.moveMode) {
|
|
9544
|
+
path = path.clone();
|
|
9545
|
+
this.downData.path.forEach(leaf => path.add(leaf));
|
|
9546
|
+
}
|
|
9547
|
+
const { enterPath } = this;
|
|
9362
9548
|
this.enterPath = path;
|
|
9549
|
+
this.emit(exports.PointerEvent.LEAVE, data, enterPath, path);
|
|
9550
|
+
this.emit(exports.PointerEvent.ENTER, data, path, enterPath);
|
|
9363
9551
|
}
|
|
9364
9552
|
touchLeave(data) {
|
|
9365
9553
|
if (data.pointerType === 'touch') {
|
|
@@ -9415,6 +9603,23 @@ var LeaferUI = (function (exports) {
|
|
|
9415
9603
|
isDrag(leaf) {
|
|
9416
9604
|
return this.dragger.getList().has(leaf);
|
|
9417
9605
|
}
|
|
9606
|
+
isPress(leaf) {
|
|
9607
|
+
const { downData, oldDownData } = this;
|
|
9608
|
+
return this.downed && ((downData && downData.path.has(leaf)) || (oldDownData && oldDownData.path.has(leaf)));
|
|
9609
|
+
}
|
|
9610
|
+
isHover(leaf) {
|
|
9611
|
+
return this.enterPath && this.enterPath.has(leaf);
|
|
9612
|
+
}
|
|
9613
|
+
isFocus(leaf) {
|
|
9614
|
+
return this.focusData === leaf;
|
|
9615
|
+
}
|
|
9616
|
+
cancelHover() {
|
|
9617
|
+
const { hoverData } = this;
|
|
9618
|
+
if (hoverData) {
|
|
9619
|
+
hoverData.path = this.defaultPath;
|
|
9620
|
+
this.pointerHover(hoverData);
|
|
9621
|
+
}
|
|
9622
|
+
}
|
|
9418
9623
|
updateDownData(data, options) {
|
|
9419
9624
|
const { downData } = this;
|
|
9420
9625
|
if (!data && downData)
|
|
@@ -9448,8 +9653,7 @@ var LeaferUI = (function (exports) {
|
|
|
9448
9653
|
}
|
|
9449
9654
|
else if (!data)
|
|
9450
9655
|
return;
|
|
9451
|
-
let leaf;
|
|
9452
|
-
let cursor;
|
|
9656
|
+
let leaf, cursor;
|
|
9453
9657
|
const { path } = data;
|
|
9454
9658
|
for (let i = 0, len = path.length; i < len; i++) {
|
|
9455
9659
|
leaf = path.list[i];
|
|
@@ -10393,10 +10597,6 @@ var LeaferUI = (function (exports) {
|
|
|
10393
10597
|
case 'strench':
|
|
10394
10598
|
if (!sameBox)
|
|
10395
10599
|
width = box.width, height = box.height;
|
|
10396
|
-
if (box.x || box.y) {
|
|
10397
|
-
data.transform = get$3();
|
|
10398
|
-
translate(data.transform, box.x, box.y);
|
|
10399
|
-
}
|
|
10400
10600
|
break;
|
|
10401
10601
|
case 'clip':
|
|
10402
10602
|
if (offset || scaleX || rotation)
|
|
@@ -10414,6 +10614,12 @@ var LeaferUI = (function (exports) {
|
|
|
10414
10614
|
if (!sameBox || rotation)
|
|
10415
10615
|
fillOrFitMode(data, mode, box, width, height, rotation);
|
|
10416
10616
|
}
|
|
10617
|
+
if (!data.transform) {
|
|
10618
|
+
if (box.x || box.y) {
|
|
10619
|
+
data.transform = get$3();
|
|
10620
|
+
translate(data.transform, box.x, box.y);
|
|
10621
|
+
}
|
|
10622
|
+
}
|
|
10417
10623
|
data.width = width;
|
|
10418
10624
|
data.height = height;
|
|
10419
10625
|
if (opacity)
|
|
@@ -10431,8 +10637,7 @@ var LeaferUI = (function (exports) {
|
|
|
10431
10637
|
leafPaint = cache.leafPaint;
|
|
10432
10638
|
}
|
|
10433
10639
|
else {
|
|
10434
|
-
leafPaint = { type: paint.type };
|
|
10435
|
-
leafPaint.image = image;
|
|
10640
|
+
leafPaint = { type: paint.type, image };
|
|
10436
10641
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
10437
10642
|
}
|
|
10438
10643
|
if (firstUse || image.loading)
|
|
@@ -10449,9 +10654,11 @@ var LeaferUI = (function (exports) {
|
|
|
10449
10654
|
onLoadError(ui, event, image.error);
|
|
10450
10655
|
}
|
|
10451
10656
|
else {
|
|
10657
|
+
ignoreRender(ui, true);
|
|
10452
10658
|
if (firstUse)
|
|
10453
10659
|
onLoad(ui, event);
|
|
10454
10660
|
leafPaint.loadId = image.load(() => {
|
|
10661
|
+
ignoreRender(ui, false);
|
|
10455
10662
|
if (!ui.destroyed) {
|
|
10456
10663
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
|
|
10457
10664
|
ui.forceUpdate('surface');
|
|
@@ -10459,6 +10666,7 @@ var LeaferUI = (function (exports) {
|
|
|
10459
10666
|
}
|
|
10460
10667
|
leafPaint.loadId = null;
|
|
10461
10668
|
}, (error) => {
|
|
10669
|
+
ignoreRender(ui, false);
|
|
10462
10670
|
onLoadError(ui, event, error);
|
|
10463
10671
|
leafPaint.loadId = null;
|
|
10464
10672
|
});
|
|
@@ -10498,11 +10706,16 @@ var LeaferUI = (function (exports) {
|
|
|
10498
10706
|
if (ui.hasEvent(type))
|
|
10499
10707
|
ui.emitEvent(new ImageEvent(type, data));
|
|
10500
10708
|
}
|
|
10709
|
+
function ignoreRender(ui, value) {
|
|
10710
|
+
const { leafer } = ui;
|
|
10711
|
+
if (leafer && leafer.viewReady)
|
|
10712
|
+
leafer.renderer.ignore = value;
|
|
10713
|
+
}
|
|
10501
10714
|
|
|
10502
10715
|
const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
|
|
10503
10716
|
const { ceil, abs: abs$1 } = Math;
|
|
10504
10717
|
function createPattern(ui, paint, pixelRatio) {
|
|
10505
|
-
let { scaleX, scaleY } = ui.
|
|
10718
|
+
let { scaleX, scaleY } = ui.__nowWorld;
|
|
10506
10719
|
const id = scaleX + '-' + scaleY;
|
|
10507
10720
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10508
10721
|
scaleX = abs$1(scaleX);
|
|
@@ -10564,7 +10777,7 @@ var LeaferUI = (function (exports) {
|
|
|
10564
10777
|
|
|
10565
10778
|
const { abs } = Math;
|
|
10566
10779
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
10567
|
-
const { scaleX, scaleY } = ui.
|
|
10780
|
+
const { scaleX, scaleY } = ui.__nowWorld;
|
|
10568
10781
|
if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
|
|
10569
10782
|
return false;
|
|
10570
10783
|
}
|
|
@@ -10606,7 +10819,7 @@ var LeaferUI = (function (exports) {
|
|
|
10606
10819
|
if (!paint.patternTask) {
|
|
10607
10820
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
10608
10821
|
paint.patternTask = null;
|
|
10609
|
-
if (canvas.bounds.hit(ui.
|
|
10822
|
+
if (canvas.bounds.hit(ui.__nowWorld))
|
|
10610
10823
|
createPattern(ui, paint, canvas.pixelRatio);
|
|
10611
10824
|
ui.forceUpdate('surface');
|
|
10612
10825
|
}), 300);
|
|
@@ -10843,8 +11056,8 @@ var LeaferUI = (function (exports) {
|
|
|
10843
11056
|
|
|
10844
11057
|
function blur(ui, current, origin) {
|
|
10845
11058
|
const { blur } = ui.__;
|
|
10846
|
-
origin.setWorldBlur(blur * ui.
|
|
10847
|
-
origin.copyWorldToInner(current, ui.
|
|
11059
|
+
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
11060
|
+
origin.copyWorldToInner(current, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10848
11061
|
origin.filter = 'none';
|
|
10849
11062
|
}
|
|
10850
11063
|
|
|
@@ -11475,10 +11688,10 @@ var LeaferUI = (function (exports) {
|
|
|
11475
11688
|
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
11476
11689
|
}
|
|
11477
11690
|
else {
|
|
11478
|
-
|
|
11691
|
+
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
11479
11692
|
scaleX = worldTransform.scaleX;
|
|
11480
11693
|
scaleY = worldTransform.scaleY;
|
|
11481
|
-
switch (
|
|
11694
|
+
switch (relative) {
|
|
11482
11695
|
case 'inner':
|
|
11483
11696
|
matrix.set(worldTransform).invert();
|
|
11484
11697
|
break;
|
|
@@ -11491,11 +11704,18 @@ var LeaferUI = (function (exports) {
|
|
|
11491
11704
|
scaleX = 1;
|
|
11492
11705
|
scaleY = 1;
|
|
11493
11706
|
break;
|
|
11707
|
+
case 'page':
|
|
11708
|
+
relative = leaf.leafer;
|
|
11709
|
+
default:
|
|
11710
|
+
matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert();
|
|
11711
|
+
const l = relative.worldTransform;
|
|
11712
|
+
scaleX /= scaleX / l.scaleX;
|
|
11713
|
+
scaleY /= scaleY / l.scaleY;
|
|
11494
11714
|
}
|
|
11495
|
-
renderBounds = leaf.getBounds('render',
|
|
11715
|
+
renderBounds = leaf.getBounds('render', relative);
|
|
11496
11716
|
}
|
|
11497
|
-
const { x, y, width, height } = new Bounds(renderBounds).scale(scale)
|
|
11498
|
-
let canvas = Creator.canvas({ width, height, pixelRatio });
|
|
11717
|
+
const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
|
|
11718
|
+
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
|
|
11499
11719
|
const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
11500
11720
|
if (slice) {
|
|
11501
11721
|
leaf = leafer;
|
|
@@ -11651,6 +11871,7 @@ var LeaferUI = (function (exports) {
|
|
|
11651
11871
|
exports.Run = Run;
|
|
11652
11872
|
exports.Selector = Selector;
|
|
11653
11873
|
exports.StarData = StarData;
|
|
11874
|
+
exports.State = State;
|
|
11654
11875
|
exports.StringNumberMap = StringNumberMap;
|
|
11655
11876
|
exports.TaskItem = TaskItem;
|
|
11656
11877
|
exports.TaskProcessor = TaskProcessor;
|
|
@@ -11694,6 +11915,7 @@ var LeaferUI = (function (exports) {
|
|
|
11694
11915
|
exports.opacityType = opacityType;
|
|
11695
11916
|
exports.pathInputType = pathInputType;
|
|
11696
11917
|
exports.pathType = pathType;
|
|
11918
|
+
exports.pen = pen;
|
|
11697
11919
|
exports.positionType = positionType;
|
|
11698
11920
|
exports.registerUI = registerUI;
|
|
11699
11921
|
exports.registerUIEvent = registerUIEvent;
|
|
@@ -11703,10 +11925,12 @@ var LeaferUI = (function (exports) {
|
|
|
11703
11925
|
exports.rotationType = rotationType;
|
|
11704
11926
|
exports.scaleType = scaleType;
|
|
11705
11927
|
exports.sortType = sortType;
|
|
11928
|
+
exports.stateType = stateType;
|
|
11706
11929
|
exports.strokeType = strokeType;
|
|
11707
11930
|
exports.surfaceType = surfaceType;
|
|
11708
11931
|
exports.useCanvas = useCanvas;
|
|
11709
11932
|
exports.useModule = useModule;
|
|
11933
|
+
exports.zoomLayerType = zoomLayerType;
|
|
11710
11934
|
|
|
11711
11935
|
return exports;
|
|
11712
11936
|
|