@leafer/core 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/lib/core.cjs +646 -555
- package/lib/core.esm.js +646 -556
- package/lib/core.esm.min.js +1 -1
- package/lib/core.min.cjs +1 -1
- package/package.json +18 -18
package/lib/core.cjs
CHANGED
|
@@ -40,6 +40,18 @@ const MathHelper = {
|
|
|
40
40
|
value = max;
|
|
41
41
|
return value;
|
|
42
42
|
},
|
|
43
|
+
minus(value, isFourNumber) {
|
|
44
|
+
if (value instanceof Array) {
|
|
45
|
+
if (isFourNumber)
|
|
46
|
+
value = MathHelper.fourNumber(value);
|
|
47
|
+
for (let i = 0; i < value.length; i++)
|
|
48
|
+
value[i] = -value[i];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
value = -value;
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
},
|
|
43
55
|
fourNumber(num, maxValue) {
|
|
44
56
|
let data;
|
|
45
57
|
if (num instanceof Array) {
|
|
@@ -723,7 +735,7 @@ const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
|
723
735
|
|
|
724
736
|
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
725
737
|
const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
|
|
726
|
-
const { float } = MathHelper;
|
|
738
|
+
const { float, fourNumber } = MathHelper;
|
|
727
739
|
const { floor, ceil: ceil$1 } = Math;
|
|
728
740
|
let right, bottom, boundsRight, boundsBottom;
|
|
729
741
|
const point = {};
|
|
@@ -743,9 +755,15 @@ const BoundsHelper = {
|
|
|
743
755
|
t.height = bounds.height;
|
|
744
756
|
},
|
|
745
757
|
copyAndSpread(t, bounds, spreadX, spreadY) {
|
|
746
|
-
if (
|
|
747
|
-
|
|
748
|
-
|
|
758
|
+
if (spreadX instanceof Array) {
|
|
759
|
+
const four = fourNumber(spreadX);
|
|
760
|
+
B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
if (!spreadY)
|
|
764
|
+
spreadY = spreadX;
|
|
765
|
+
B.set(t, bounds.x - spreadX, bounds.y - spreadY, bounds.width + spreadX * 2, bounds.height + spreadY * 2);
|
|
766
|
+
}
|
|
749
767
|
},
|
|
750
768
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
751
769
|
minY(t) { return t.height > 0 ? t.y : t.y + t.height; },
|
|
@@ -1023,8 +1041,12 @@ class Bounds {
|
|
|
1023
1041
|
getFitMatrix(put) {
|
|
1024
1042
|
return BoundsHelper.getFitMatrix(this, put);
|
|
1025
1043
|
}
|
|
1026
|
-
spread(
|
|
1027
|
-
BoundsHelper.spread(this,
|
|
1044
|
+
spread(fourNumber, spreadY) {
|
|
1045
|
+
BoundsHelper.spread(this, fourNumber, spreadY);
|
|
1046
|
+
return this;
|
|
1047
|
+
}
|
|
1048
|
+
shrink(fourNumber) {
|
|
1049
|
+
BoundsHelper.spread(this, MathHelper.minus(fourNumber, true));
|
|
1028
1050
|
return this;
|
|
1029
1051
|
}
|
|
1030
1052
|
ceil() {
|
|
@@ -1449,17 +1471,30 @@ class LeafData {
|
|
|
1449
1471
|
if (this.__input && this.__input[name] !== undefined)
|
|
1450
1472
|
this.__input[name] = undefined;
|
|
1451
1473
|
}
|
|
1452
|
-
__getInputData() {
|
|
1453
|
-
const data = {
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1474
|
+
__getInputData(names) {
|
|
1475
|
+
const data = {};
|
|
1476
|
+
if (names) {
|
|
1477
|
+
if (names instanceof Array) {
|
|
1478
|
+
for (let name of names)
|
|
1479
|
+
data[name] = this.__getInput(name);
|
|
1480
|
+
}
|
|
1481
|
+
else {
|
|
1482
|
+
for (let name in names)
|
|
1483
|
+
data[name] = this.__getInput(name);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
let value, inputValue, { __input } = this;
|
|
1488
|
+
data.tag = this.__leaf.tag;
|
|
1489
|
+
for (let key in this) {
|
|
1490
|
+
if (key[0] !== '_') {
|
|
1491
|
+
value = this['_' + key];
|
|
1492
|
+
if (value !== undefined) {
|
|
1493
|
+
if (key === 'path' && !this.__pathInputed)
|
|
1494
|
+
continue;
|
|
1495
|
+
inputValue = __input ? __input[key] : undefined;
|
|
1496
|
+
data[key] = (inputValue === undefined) ? value : inputValue;
|
|
1497
|
+
}
|
|
1463
1498
|
}
|
|
1464
1499
|
}
|
|
1465
1500
|
}
|
|
@@ -2820,12 +2855,16 @@ class PathCreator {
|
|
|
2820
2855
|
set path(value) { this.__path = value; }
|
|
2821
2856
|
get path() { return this.__path; }
|
|
2822
2857
|
constructor(path) {
|
|
2858
|
+
this.set(path);
|
|
2859
|
+
}
|
|
2860
|
+
set(path) {
|
|
2823
2861
|
if (path) {
|
|
2824
2862
|
this.__path = typeof path === 'string' ? PathHelper.parse(path) : path;
|
|
2825
2863
|
}
|
|
2826
2864
|
else {
|
|
2827
2865
|
this.__path = [];
|
|
2828
2866
|
}
|
|
2867
|
+
return this;
|
|
2829
2868
|
}
|
|
2830
2869
|
beginPath() {
|
|
2831
2870
|
beginPath(this.__path);
|
|
@@ -3139,6 +3178,7 @@ const PathCorner = {
|
|
|
3139
3178
|
PathHelper.creator = new PathCreator();
|
|
3140
3179
|
PathHelper.parse = PathConvert.parse;
|
|
3141
3180
|
PathHelper.convertToCanvasData = PathConvert.toCanvasData;
|
|
3181
|
+
const pen = new PathCreator();
|
|
3142
3182
|
|
|
3143
3183
|
const { drawRoundRect } = RectHelper;
|
|
3144
3184
|
function roundRect(drawer) {
|
|
@@ -3423,7 +3463,7 @@ const ImageManager = {
|
|
|
3423
3463
|
},
|
|
3424
3464
|
clearRecycled() {
|
|
3425
3465
|
const list = I.recycledList;
|
|
3426
|
-
if (list.length) {
|
|
3466
|
+
if (list.length > 100) {
|
|
3427
3467
|
list.forEach(image => {
|
|
3428
3468
|
if (!image.use && image.url) {
|
|
3429
3469
|
delete I.map[image.url];
|
|
@@ -3675,6 +3715,8 @@ function affectStrokeBoundsType(defaultValue) {
|
|
|
3675
3715
|
}
|
|
3676
3716
|
function doStrokeType(leaf) {
|
|
3677
3717
|
leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
|
|
3718
|
+
if (leaf.__.__useArrow)
|
|
3719
|
+
doBoundsType(leaf);
|
|
3678
3720
|
}
|
|
3679
3721
|
const strokeType = affectStrokeBoundsType;
|
|
3680
3722
|
function affectRenderBoundsType(defaultValue) {
|
|
@@ -3878,133 +3920,413 @@ function registerUIEvent() {
|
|
|
3878
3920
|
};
|
|
3879
3921
|
}
|
|
3880
3922
|
|
|
3881
|
-
const
|
|
3882
|
-
const
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
get e() { return this.leaf.__.x; }
|
|
3893
|
-
get f() { return this.leaf.__.y; }
|
|
3894
|
-
get x() { return this.e + this.boxBounds.x; }
|
|
3895
|
-
get y() { return this.f + this.boxBounds.y; }
|
|
3896
|
-
get width() { return this.boxBounds.width; }
|
|
3897
|
-
get height() { return this.boxBounds.height; }
|
|
3898
|
-
constructor(leaf) {
|
|
3899
|
-
this.leaf = leaf;
|
|
3900
|
-
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
3901
|
-
if (this.leaf.__local)
|
|
3902
|
-
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
3903
|
-
this.boxChange();
|
|
3904
|
-
this.matrixChange();
|
|
3905
|
-
}
|
|
3906
|
-
createLocal() {
|
|
3907
|
-
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 };
|
|
3908
|
-
if (!this._localStrokeBounds)
|
|
3909
|
-
this._localStrokeBounds = local;
|
|
3910
|
-
if (!this._localRenderBounds)
|
|
3911
|
-
this._localRenderBounds = local;
|
|
3912
|
-
}
|
|
3913
|
-
update() {
|
|
3914
|
-
const { leafer } = this.leaf;
|
|
3915
|
-
if (leafer) {
|
|
3916
|
-
if (leafer.ready) {
|
|
3917
|
-
if (leafer.watcher.changed)
|
|
3918
|
-
leafer.layouter.layout();
|
|
3923
|
+
const { copy: copy$2, toInnerPoint: toInnerPoint$1, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3924
|
+
const matrix = {};
|
|
3925
|
+
const LeafHelper = {
|
|
3926
|
+
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
3927
|
+
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
3928
|
+
waitAutoLayout = true;
|
|
3929
|
+
updateMatrix$1(leaf, checkAutoLayout, waitAutoLayout);
|
|
3930
|
+
if (leaf.isBranch) {
|
|
3931
|
+
const { children } = leaf;
|
|
3932
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3933
|
+
updateAllMatrix$1(children[i], checkAutoLayout, waitAutoLayout);
|
|
3919
3934
|
}
|
|
3920
|
-
|
|
3921
|
-
|
|
3935
|
+
}
|
|
3936
|
+
},
|
|
3937
|
+
updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
3938
|
+
const layout = leaf.__layout;
|
|
3939
|
+
if (checkAutoLayout) {
|
|
3940
|
+
if (waitAutoLayout) {
|
|
3941
|
+
layout.waitAutoLayout = true;
|
|
3942
|
+
if (leaf.__hasAutoLayout)
|
|
3943
|
+
layout.matrixChanged = false;
|
|
3922
3944
|
}
|
|
3923
3945
|
}
|
|
3924
|
-
else {
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3946
|
+
else if (layout.waitAutoLayout) {
|
|
3947
|
+
layout.waitAutoLayout = false;
|
|
3948
|
+
}
|
|
3949
|
+
if (layout.matrixChanged)
|
|
3950
|
+
leaf.__updateLocalMatrix();
|
|
3951
|
+
if (!layout.waitAutoLayout)
|
|
3952
|
+
leaf.__updateWorldMatrix();
|
|
3953
|
+
},
|
|
3954
|
+
updateBounds(leaf) {
|
|
3955
|
+
const layout = leaf.__layout;
|
|
3956
|
+
if (layout.boundsChanged)
|
|
3957
|
+
leaf.__updateLocalBounds();
|
|
3958
|
+
if (!layout.waitAutoLayout)
|
|
3959
|
+
leaf.__updateWorldBounds();
|
|
3960
|
+
},
|
|
3961
|
+
updateAllWorldOpacity(leaf) {
|
|
3962
|
+
leaf.__updateWorldOpacity();
|
|
3963
|
+
if (leaf.isBranch) {
|
|
3964
|
+
const { children } = leaf;
|
|
3965
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3966
|
+
updateAllWorldOpacity(children[i]);
|
|
3928
3967
|
}
|
|
3929
|
-
Platform.layout(root);
|
|
3930
3968
|
}
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
return MatrixHelper.defaultMatrix;
|
|
3941
|
-
default:
|
|
3942
|
-
return new Matrix(this.leaf.__world).divideParent(relative.__world);
|
|
3969
|
+
},
|
|
3970
|
+
updateAllChange(leaf) {
|
|
3971
|
+
updateAllWorldOpacity(leaf);
|
|
3972
|
+
leaf.__updateChange();
|
|
3973
|
+
if (leaf.isBranch) {
|
|
3974
|
+
const { children } = leaf;
|
|
3975
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
3976
|
+
updateAllChange(children[i]);
|
|
3977
|
+
}
|
|
3943
3978
|
}
|
|
3944
|
-
}
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
case 'local':
|
|
3951
|
-
return this.getLocalBounds(type);
|
|
3952
|
-
case 'inner':
|
|
3953
|
-
return this.getInnerBounds(type);
|
|
3954
|
-
default:
|
|
3955
|
-
return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
|
|
3979
|
+
},
|
|
3980
|
+
worldHittable(t) {
|
|
3981
|
+
while (t) {
|
|
3982
|
+
if (!t.__.hittable)
|
|
3983
|
+
return false;
|
|
3984
|
+
t = t.parent;
|
|
3956
3985
|
}
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3986
|
+
return true;
|
|
3987
|
+
},
|
|
3988
|
+
moveWorld(t, x, y) {
|
|
3989
|
+
const local = { x, y };
|
|
3990
|
+
if (t.parent)
|
|
3991
|
+
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3992
|
+
L.moveLocal(t, local.x, local.y);
|
|
3993
|
+
},
|
|
3994
|
+
moveLocal(t, x, y = 0) {
|
|
3995
|
+
t.x += x;
|
|
3996
|
+
t.y += y;
|
|
3997
|
+
},
|
|
3998
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
3999
|
+
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4000
|
+
},
|
|
4001
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4002
|
+
copy$2(matrix, t.__localMatrix);
|
|
4003
|
+
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4004
|
+
moveByMatrix(t, matrix);
|
|
4005
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4006
|
+
},
|
|
4007
|
+
rotateOfWorld(t, origin, angle) {
|
|
4008
|
+
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4009
|
+
},
|
|
4010
|
+
rotateOfLocal(t, origin, angle) {
|
|
4011
|
+
copy$2(matrix, t.__localMatrix);
|
|
4012
|
+
rotateOfOuter(matrix, origin, angle);
|
|
4013
|
+
moveByMatrix(t, matrix);
|
|
4014
|
+
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4015
|
+
},
|
|
4016
|
+
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4017
|
+
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4018
|
+
},
|
|
4019
|
+
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4020
|
+
copy$2(matrix, t.__localMatrix);
|
|
4021
|
+
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4022
|
+
L.setTransform(t, matrix, resize);
|
|
4023
|
+
},
|
|
4024
|
+
transformWorld(t, transform, resize) {
|
|
4025
|
+
copy$2(matrix, t.worldTransform);
|
|
4026
|
+
multiplyParent$2(matrix, transform);
|
|
4027
|
+
if (t.parent)
|
|
4028
|
+
divideParent(matrix, t.parent.worldTransform);
|
|
4029
|
+
L.setTransform(t, matrix, resize);
|
|
4030
|
+
},
|
|
4031
|
+
transform(t, transform, resize) {
|
|
4032
|
+
copy$2(matrix, t.localTransform);
|
|
4033
|
+
multiplyParent$2(matrix, transform);
|
|
4034
|
+
L.setTransform(t, matrix, resize);
|
|
4035
|
+
},
|
|
4036
|
+
setTransform(t, transform, resize) {
|
|
4037
|
+
const layout = getLayout(transform);
|
|
4038
|
+
if (resize) {
|
|
4039
|
+
t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
|
|
4040
|
+
delete layout.scaleX;
|
|
4041
|
+
delete layout.scaleY;
|
|
3970
4042
|
}
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
4043
|
+
t.set(layout);
|
|
4044
|
+
},
|
|
4045
|
+
getRelativeWorld(t, relative, temp) {
|
|
4046
|
+
copy$2(matrix, t.worldTransform);
|
|
4047
|
+
divideParent(matrix, relative.worldTransform);
|
|
4048
|
+
return temp ? matrix : Object.assign({}, matrix);
|
|
4049
|
+
},
|
|
4050
|
+
drop(t, parent, index, resize) {
|
|
4051
|
+
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
4052
|
+
parent.add(t, index);
|
|
4053
|
+
},
|
|
4054
|
+
hasParent(p, parent) {
|
|
4055
|
+
if (!parent)
|
|
4056
|
+
return false;
|
|
4057
|
+
while (p) {
|
|
4058
|
+
if (parent === p)
|
|
4059
|
+
return true;
|
|
4060
|
+
p = p.parent;
|
|
3982
4061
|
}
|
|
3983
|
-
}
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
if (this.contentBounds)
|
|
3990
|
-
return this.getWorldContentBounds();
|
|
3991
|
-
case 'margin':
|
|
3992
|
-
case 'box':
|
|
3993
|
-
return this.getWorldBoxBounds();
|
|
3994
|
-
case 'margin':
|
|
3995
|
-
case 'stroke':
|
|
3996
|
-
return this.getWorldStrokeBounds();
|
|
4062
|
+
},
|
|
4063
|
+
hasParentAutoLayout(p) {
|
|
4064
|
+
while (p.parent) {
|
|
4065
|
+
p = p.parent;
|
|
4066
|
+
if (p.__hasAutoLayout)
|
|
4067
|
+
return true;
|
|
3997
4068
|
}
|
|
3998
4069
|
}
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4070
|
+
};
|
|
4071
|
+
const L = LeafHelper;
|
|
4072
|
+
const { updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity, updateAllChange } = L;
|
|
4073
|
+
function moveByMatrix(t, matrix) {
|
|
4074
|
+
const { e, f } = t.__localMatrix;
|
|
4075
|
+
t.x += matrix.e - e;
|
|
4076
|
+
t.y += matrix.f - f;
|
|
4077
|
+
}
|
|
4078
|
+
function getTempLocal(t, world) {
|
|
4079
|
+
t.__layout.update();
|
|
4080
|
+
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4081
|
+
}
|
|
4082
|
+
|
|
4083
|
+
const LeafBoundsHelper = {
|
|
4084
|
+
worldBounds(target) {
|
|
4085
|
+
return target.__world;
|
|
4086
|
+
},
|
|
4087
|
+
localBoxBounds(target) {
|
|
4088
|
+
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4089
|
+
},
|
|
4090
|
+
localStrokeBounds(target) {
|
|
4091
|
+
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4092
|
+
},
|
|
4093
|
+
localRenderBounds(target) {
|
|
4094
|
+
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4095
|
+
},
|
|
4096
|
+
maskLocalBoxBounds(target) {
|
|
4097
|
+
return target.__.mask ? target.__localBoxBounds : null;
|
|
4098
|
+
},
|
|
4099
|
+
maskLocalStrokeBounds(target) {
|
|
4100
|
+
return target.__.mask ? target.__layout.localStrokeBounds : null;
|
|
4101
|
+
},
|
|
4102
|
+
maskLocalRenderBounds(target) {
|
|
4103
|
+
return target.__.mask ? target.__layout.localRenderBounds : null;
|
|
4104
|
+
},
|
|
4105
|
+
excludeRenderBounds(child, options) {
|
|
4106
|
+
if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
|
|
4107
|
+
return true;
|
|
4108
|
+
if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
|
|
4109
|
+
return true;
|
|
4110
|
+
return false;
|
|
4111
|
+
}
|
|
4112
|
+
};
|
|
4113
|
+
|
|
4114
|
+
const { updateBounds: updateBounds$1 } = LeafHelper;
|
|
4115
|
+
const BranchHelper = {
|
|
4116
|
+
sort(a, b) {
|
|
4117
|
+
return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
|
|
4118
|
+
},
|
|
4119
|
+
pushAllChildBranch(branch, leafList) {
|
|
4120
|
+
branch.__tempNumber = 1;
|
|
4121
|
+
if (branch.__.__childBranchNumber) {
|
|
4122
|
+
const { children } = branch;
|
|
4123
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4124
|
+
branch = children[i];
|
|
4125
|
+
if (branch.isBranch) {
|
|
4126
|
+
branch.__tempNumber = 1;
|
|
4127
|
+
leafList.add(branch);
|
|
4128
|
+
pushAllChildBranch(branch, leafList);
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4132
|
+
},
|
|
4133
|
+
pushAllParent(leaf, leafList) {
|
|
4134
|
+
const { keys } = leafList;
|
|
4135
|
+
if (keys) {
|
|
4136
|
+
while (leaf.parent) {
|
|
4137
|
+
if (keys[leaf.parent.innerId] === undefined) {
|
|
4138
|
+
leafList.add(leaf.parent);
|
|
4139
|
+
leaf = leaf.parent;
|
|
4140
|
+
}
|
|
4141
|
+
else {
|
|
4142
|
+
break;
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
else {
|
|
4147
|
+
while (leaf.parent) {
|
|
4148
|
+
leafList.add(leaf.parent);
|
|
4149
|
+
leaf = leaf.parent;
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
},
|
|
4153
|
+
pushAllBranchStack(branch, pushList) {
|
|
4154
|
+
let start = pushList.length;
|
|
4155
|
+
const { children } = branch;
|
|
4156
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4157
|
+
if (children[i].isBranch) {
|
|
4158
|
+
pushList.push(children[i]);
|
|
4159
|
+
}
|
|
4160
|
+
}
|
|
4161
|
+
for (let i = start, len = pushList.length; i < len; i++) {
|
|
4162
|
+
pushAllBranchStack(pushList[i], pushList);
|
|
4163
|
+
}
|
|
4164
|
+
},
|
|
4165
|
+
updateBounds(branch, exclude) {
|
|
4166
|
+
const branchStack = [branch];
|
|
4167
|
+
pushAllBranchStack(branch, branchStack);
|
|
4168
|
+
updateBoundsByBranchStack(branchStack, exclude);
|
|
4169
|
+
},
|
|
4170
|
+
updateBoundsByBranchStack(branchStack, exclude) {
|
|
4171
|
+
let branch, children;
|
|
4172
|
+
for (let i = branchStack.length - 1; i > -1; i--) {
|
|
4173
|
+
branch = branchStack[i];
|
|
4174
|
+
children = branch.children;
|
|
4175
|
+
for (let j = 0, len = children.length; j < len; j++) {
|
|
4176
|
+
updateBounds$1(children[j]);
|
|
4177
|
+
}
|
|
4178
|
+
if (exclude && exclude === branch)
|
|
4179
|
+
continue;
|
|
4180
|
+
updateBounds$1(branch);
|
|
4181
|
+
}
|
|
4182
|
+
}
|
|
4183
|
+
};
|
|
4184
|
+
const { pushAllChildBranch, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
|
|
4185
|
+
|
|
4186
|
+
const WaitHelper = {
|
|
4187
|
+
run(wait) {
|
|
4188
|
+
if (wait.length) {
|
|
4189
|
+
const len = wait.length;
|
|
4190
|
+
for (let i = 0; i < len; i++) {
|
|
4191
|
+
wait[i]();
|
|
4192
|
+
}
|
|
4193
|
+
wait.length === len ? wait.length = 0 : wait.splice(0, len);
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
};
|
|
4197
|
+
|
|
4198
|
+
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4199
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$1 } = BoundsHelper;
|
|
4200
|
+
class LeafLayout {
|
|
4201
|
+
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4202
|
+
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4203
|
+
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4204
|
+
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4205
|
+
get a() { return 1; }
|
|
4206
|
+
get b() { return 0; }
|
|
4207
|
+
get c() { return 0; }
|
|
4208
|
+
get d() { return 1; }
|
|
4209
|
+
get e() { return this.leaf.__.x; }
|
|
4210
|
+
get f() { return this.leaf.__.y; }
|
|
4211
|
+
get x() { return this.e + this.boxBounds.x; }
|
|
4212
|
+
get y() { return this.f + this.boxBounds.y; }
|
|
4213
|
+
get width() { return this.boxBounds.width; }
|
|
4214
|
+
get height() { return this.boxBounds.height; }
|
|
4215
|
+
constructor(leaf) {
|
|
4216
|
+
this.leaf = leaf;
|
|
4217
|
+
this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
|
|
4218
|
+
if (this.leaf.__local)
|
|
4219
|
+
this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
|
|
4220
|
+
this.boxChange();
|
|
4221
|
+
this.matrixChange();
|
|
4222
|
+
}
|
|
4223
|
+
createLocal() {
|
|
4224
|
+
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 };
|
|
4225
|
+
if (!this._localStrokeBounds)
|
|
4226
|
+
this._localStrokeBounds = local;
|
|
4227
|
+
if (!this._localRenderBounds)
|
|
4228
|
+
this._localRenderBounds = local;
|
|
4229
|
+
}
|
|
4230
|
+
update() {
|
|
4231
|
+
const { leafer } = this.leaf;
|
|
4232
|
+
if (leafer) {
|
|
4233
|
+
if (leafer.ready) {
|
|
4234
|
+
if (leafer.watcher.changed)
|
|
4235
|
+
leafer.layouter.layout();
|
|
4236
|
+
}
|
|
4237
|
+
else {
|
|
4238
|
+
leafer.start();
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
else {
|
|
4242
|
+
let root = this.leaf;
|
|
4243
|
+
while (root.parent && !root.parent.leafer) {
|
|
4244
|
+
root = root.parent;
|
|
4245
|
+
}
|
|
4246
|
+
Platform.layout(root);
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
getTransform(relative = 'world') {
|
|
4250
|
+
this.update();
|
|
4251
|
+
const { leaf } = this;
|
|
4252
|
+
switch (relative) {
|
|
4253
|
+
case 'world':
|
|
4254
|
+
return leaf.__world;
|
|
4255
|
+
case 'local':
|
|
4256
|
+
return leaf.__localMatrix;
|
|
4257
|
+
case 'inner':
|
|
4258
|
+
return MatrixHelper.defaultMatrix;
|
|
4259
|
+
case 'page':
|
|
4260
|
+
relative = leaf.zoomLayer;
|
|
4261
|
+
default:
|
|
4262
|
+
return getRelativeWorld$1(leaf, relative);
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
getBounds(type, relative = 'world') {
|
|
4266
|
+
this.update();
|
|
4267
|
+
switch (relative) {
|
|
4268
|
+
case 'world':
|
|
4269
|
+
return this.getWorldBounds(type);
|
|
4270
|
+
case 'local':
|
|
4271
|
+
return this.getLocalBounds(type);
|
|
4272
|
+
case 'inner':
|
|
4273
|
+
return this.getInnerBounds(type);
|
|
4274
|
+
case 'page':
|
|
4275
|
+
relative = this.leaf.zoomLayer;
|
|
4276
|
+
default:
|
|
4277
|
+
return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
4280
|
+
getInnerBounds(type = 'box') {
|
|
4281
|
+
switch (type) {
|
|
4282
|
+
case 'render':
|
|
4283
|
+
return this.renderBounds;
|
|
4284
|
+
case 'content':
|
|
4285
|
+
if (this.contentBounds)
|
|
4286
|
+
return this.contentBounds;
|
|
4287
|
+
case 'margin':
|
|
4288
|
+
case 'box':
|
|
4289
|
+
return this.boxBounds;
|
|
4290
|
+
case 'stroke':
|
|
4291
|
+
return this.strokeBounds;
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
getLocalBounds(type = 'box') {
|
|
4295
|
+
switch (type) {
|
|
4296
|
+
case 'render':
|
|
4297
|
+
return this.localRenderBounds;
|
|
4298
|
+
case 'stroke':
|
|
4299
|
+
return this.localStrokeBounds;
|
|
4300
|
+
case 'margin':
|
|
4301
|
+
case 'content':
|
|
4302
|
+
case 'box':
|
|
4303
|
+
return this.leaf.__localBoxBounds;
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
getWorldBounds(type = 'box') {
|
|
4307
|
+
switch (type) {
|
|
4308
|
+
case 'render':
|
|
4309
|
+
return this.leaf.__world;
|
|
4310
|
+
case 'content':
|
|
4311
|
+
if (this.contentBounds)
|
|
4312
|
+
return this.getWorldContentBounds();
|
|
4313
|
+
case 'margin':
|
|
4314
|
+
case 'box':
|
|
4315
|
+
return this.getWorldBoxBounds();
|
|
4316
|
+
case 'margin':
|
|
4317
|
+
case 'stroke':
|
|
4318
|
+
return this.getWorldStrokeBounds();
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
getLayoutBounds(type, relative = 'world', unscale) {
|
|
4322
|
+
const { leaf } = this;
|
|
4323
|
+
let point, matrix, bounds = this.getInnerBounds(type);
|
|
4324
|
+
switch (relative) {
|
|
4325
|
+
case 'world':
|
|
4326
|
+
point = leaf.getWorldPoint(bounds);
|
|
4327
|
+
matrix = leaf.__world;
|
|
4328
|
+
break;
|
|
4329
|
+
case 'local':
|
|
4008
4330
|
point = leaf.getLocalPointByInner(bounds);
|
|
4009
4331
|
matrix = leaf.__localMatrix;
|
|
4010
4332
|
break;
|
|
@@ -4012,12 +4334,14 @@ class LeafLayout {
|
|
|
4012
4334
|
point = bounds;
|
|
4013
4335
|
matrix = MatrixHelper.defaultMatrix;
|
|
4014
4336
|
break;
|
|
4337
|
+
case 'page':
|
|
4338
|
+
relative = leaf.zoomLayer;
|
|
4015
4339
|
default:
|
|
4016
4340
|
point = leaf.getWorldPoint(bounds, relative);
|
|
4017
|
-
matrix =
|
|
4341
|
+
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4018
4342
|
}
|
|
4019
4343
|
const layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4020
|
-
copy$
|
|
4344
|
+
copy$1(layoutBounds, bounds);
|
|
4021
4345
|
PointHelper.copy(layoutBounds, point);
|
|
4022
4346
|
if (unscale) {
|
|
4023
4347
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -4045,6 +4369,8 @@ class LeafLayout {
|
|
|
4045
4369
|
break;
|
|
4046
4370
|
case 'inner':
|
|
4047
4371
|
break;
|
|
4372
|
+
case 'page':
|
|
4373
|
+
relative = leaf.zoomLayer;
|
|
4048
4374
|
default:
|
|
4049
4375
|
relativeLeaf = relative;
|
|
4050
4376
|
}
|
|
@@ -4305,438 +4631,166 @@ class PropertyEvent extends Event {
|
|
|
4305
4631
|
this.newValue = newValue;
|
|
4306
4632
|
}
|
|
4307
4633
|
}
|
|
4308
|
-
PropertyEvent.CHANGE = 'property.change';
|
|
4309
|
-
PropertyEvent.LEAFER_CHANGE = 'property.leafer_change';
|
|
4310
|
-
|
|
4311
|
-
class ImageEvent extends Event {
|
|
4312
|
-
constructor(type, data) {
|
|
4313
|
-
super(type);
|
|
4314
|
-
Object.assign(this, data);
|
|
4315
|
-
}
|
|
4316
|
-
}
|
|
4317
|
-
ImageEvent.LOAD = 'image.load';
|
|
4318
|
-
ImageEvent.LOADED = 'image.loaded';
|
|
4319
|
-
ImageEvent.ERROR = 'image.error';
|
|
4320
|
-
|
|
4321
|
-
class ResizeEvent extends Event {
|
|
4322
|
-
get bigger() {
|
|
4323
|
-
if (!this.old)
|
|
4324
|
-
return true;
|
|
4325
|
-
const { width, height } = this.old;
|
|
4326
|
-
return this.width >= width && this.height >= height;
|
|
4327
|
-
}
|
|
4328
|
-
get smaller() {
|
|
4329
|
-
return !this.bigger;
|
|
4330
|
-
}
|
|
4331
|
-
get samePixelRatio() {
|
|
4332
|
-
if (!this.old)
|
|
4333
|
-
return true;
|
|
4334
|
-
return this.pixelRatio === this.old.pixelRatio;
|
|
4335
|
-
}
|
|
4336
|
-
constructor(size, oldSize) {
|
|
4337
|
-
if (typeof size === 'object') {
|
|
4338
|
-
super(ResizeEvent.RESIZE);
|
|
4339
|
-
Object.assign(this, size);
|
|
4340
|
-
}
|
|
4341
|
-
else {
|
|
4342
|
-
super(size);
|
|
4343
|
-
}
|
|
4344
|
-
this.old = oldSize;
|
|
4345
|
-
}
|
|
4346
|
-
}
|
|
4347
|
-
ResizeEvent.RESIZE = 'resize';
|
|
4348
|
-
|
|
4349
|
-
class WatchEvent extends Event {
|
|
4350
|
-
constructor(type, data) {
|
|
4351
|
-
super(type);
|
|
4352
|
-
this.data = data;
|
|
4353
|
-
}
|
|
4354
|
-
}
|
|
4355
|
-
WatchEvent.REQUEST = 'watch.request';
|
|
4356
|
-
WatchEvent.DATA = 'watch.data';
|
|
4357
|
-
|
|
4358
|
-
class LayoutEvent extends Event {
|
|
4359
|
-
constructor(type, data, times) {
|
|
4360
|
-
super(type);
|
|
4361
|
-
if (data) {
|
|
4362
|
-
this.data = data;
|
|
4363
|
-
this.times = times;
|
|
4364
|
-
}
|
|
4365
|
-
}
|
|
4366
|
-
}
|
|
4367
|
-
LayoutEvent.CHECK_UPDATE = 'layout.check_update';
|
|
4368
|
-
LayoutEvent.REQUEST = 'layout.request';
|
|
4369
|
-
LayoutEvent.START = 'layout.start';
|
|
4370
|
-
LayoutEvent.BEFORE = 'layout.before';
|
|
4371
|
-
LayoutEvent.LAYOUT = 'layout';
|
|
4372
|
-
LayoutEvent.AFTER = 'layout.after';
|
|
4373
|
-
LayoutEvent.AGAIN = 'layout.again';
|
|
4374
|
-
LayoutEvent.END = 'layout.end';
|
|
4375
|
-
|
|
4376
|
-
class AnimateEvent extends Event {
|
|
4377
|
-
}
|
|
4378
|
-
AnimateEvent.FRAME = 'animate.frame';
|
|
4379
|
-
|
|
4380
|
-
class RenderEvent extends Event {
|
|
4381
|
-
constructor(type, times, bounds, options) {
|
|
4382
|
-
super(type);
|
|
4383
|
-
if (times)
|
|
4384
|
-
this.times = times;
|
|
4385
|
-
if (bounds) {
|
|
4386
|
-
this.renderBounds = bounds;
|
|
4387
|
-
this.renderOptions = options;
|
|
4388
|
-
}
|
|
4389
|
-
}
|
|
4390
|
-
}
|
|
4391
|
-
RenderEvent.REQUEST = 'render.request';
|
|
4392
|
-
RenderEvent.START = 'render.start';
|
|
4393
|
-
RenderEvent.BEFORE = 'render.before';
|
|
4394
|
-
RenderEvent.RENDER = 'render';
|
|
4395
|
-
RenderEvent.AFTER = 'render.after';
|
|
4396
|
-
RenderEvent.AGAIN = 'render.again';
|
|
4397
|
-
RenderEvent.END = 'render.end';
|
|
4398
|
-
RenderEvent.NEXT = 'render.next';
|
|
4399
|
-
|
|
4400
|
-
class LeaferEvent extends Event {
|
|
4401
|
-
}
|
|
4402
|
-
LeaferEvent.START = 'leafer.start';
|
|
4403
|
-
LeaferEvent.BEFORE_READY = 'leafer.before_ready';
|
|
4404
|
-
LeaferEvent.READY = 'leafer.ready';
|
|
4405
|
-
LeaferEvent.AFTER_READY = 'leafer.after_ready';
|
|
4406
|
-
LeaferEvent.VIEW_READY = 'leafer.view_ready';
|
|
4407
|
-
LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
|
|
4408
|
-
LeaferEvent.STOP = 'leafer.stop';
|
|
4409
|
-
LeaferEvent.RESTART = 'leafer.restart';
|
|
4410
|
-
LeaferEvent.END = 'leafer.end';
|
|
4411
|
-
|
|
4412
|
-
const LeafDataProxy = {
|
|
4413
|
-
__setAttr(name, newValue) {
|
|
4414
|
-
if (this.leafer && this.leafer.created) {
|
|
4415
|
-
const oldValue = this.__.__getInput(name);
|
|
4416
|
-
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4417
|
-
this.__[name] = newValue;
|
|
4418
|
-
if (this.__proxyData)
|
|
4419
|
-
this.setProxyAttr(name, newValue);
|
|
4420
|
-
const { CHANGE } = PropertyEvent;
|
|
4421
|
-
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4422
|
-
if (this.isLeafer) {
|
|
4423
|
-
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
4424
|
-
}
|
|
4425
|
-
else {
|
|
4426
|
-
if (this.hasEvent(CHANGE))
|
|
4427
|
-
this.emitEvent(event);
|
|
4428
|
-
}
|
|
4429
|
-
this.leafer.emitEvent(event);
|
|
4430
|
-
}
|
|
4431
|
-
}
|
|
4432
|
-
else {
|
|
4433
|
-
this.__[name] = newValue;
|
|
4434
|
-
if (this.__proxyData)
|
|
4435
|
-
this.setProxyAttr(name, newValue);
|
|
4436
|
-
}
|
|
4437
|
-
},
|
|
4438
|
-
__getAttr(name) {
|
|
4439
|
-
if (this.__proxyData)
|
|
4440
|
-
return this.getProxyAttr(name);
|
|
4441
|
-
return this.__.__get(name);
|
|
4442
|
-
}
|
|
4443
|
-
};
|
|
4444
|
-
|
|
4445
|
-
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
4446
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4447
|
-
const LeafMatrix = {
|
|
4448
|
-
__updateWorldMatrix() {
|
|
4449
|
-
multiplyParent$2(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4450
|
-
},
|
|
4451
|
-
__updateLocalMatrix() {
|
|
4452
|
-
if (this.__local) {
|
|
4453
|
-
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4454
|
-
if (layout.affectScaleOrRotation) {
|
|
4455
|
-
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4456
|
-
setLayout(local, data, null, layout.affectRotation);
|
|
4457
|
-
layout.scaleChanged = layout.rotationChanged = false;
|
|
4458
|
-
}
|
|
4459
|
-
}
|
|
4460
|
-
local.e = data.x;
|
|
4461
|
-
local.f = data.y;
|
|
4462
|
-
if (data.around) {
|
|
4463
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4464
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4465
|
-
}
|
|
4466
|
-
}
|
|
4467
|
-
this.__layout.matrixChanged = false;
|
|
4468
|
-
}
|
|
4469
|
-
};
|
|
4470
|
-
|
|
4471
|
-
const { copy: copy$1, toInnerPoint: toInnerPoint$1, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent: multiplyParent$1, divideParent, getLayout } = MatrixHelper;
|
|
4472
|
-
const matrix = {};
|
|
4473
|
-
const LeafHelper = {
|
|
4474
|
-
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4475
|
-
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
4476
|
-
waitAutoLayout = true;
|
|
4477
|
-
updateMatrix$1(leaf, checkAutoLayout, waitAutoLayout);
|
|
4478
|
-
if (leaf.isBranch) {
|
|
4479
|
-
const { children } = leaf;
|
|
4480
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4481
|
-
updateAllMatrix$1(children[i], checkAutoLayout, waitAutoLayout);
|
|
4482
|
-
}
|
|
4483
|
-
}
|
|
4484
|
-
},
|
|
4485
|
-
updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4486
|
-
const layout = leaf.__layout;
|
|
4487
|
-
if (checkAutoLayout) {
|
|
4488
|
-
if (waitAutoLayout) {
|
|
4489
|
-
layout.waitAutoLayout = true;
|
|
4490
|
-
if (leaf.__hasAutoLayout)
|
|
4491
|
-
layout.matrixChanged = false;
|
|
4492
|
-
}
|
|
4493
|
-
}
|
|
4494
|
-
else if (layout.waitAutoLayout) {
|
|
4495
|
-
layout.waitAutoLayout = false;
|
|
4496
|
-
}
|
|
4497
|
-
if (layout.matrixChanged)
|
|
4498
|
-
leaf.__updateLocalMatrix();
|
|
4499
|
-
if (!layout.waitAutoLayout)
|
|
4500
|
-
leaf.__updateWorldMatrix();
|
|
4501
|
-
},
|
|
4502
|
-
updateBounds(leaf) {
|
|
4503
|
-
const layout = leaf.__layout;
|
|
4504
|
-
if (layout.boundsChanged)
|
|
4505
|
-
leaf.__updateLocalBounds();
|
|
4506
|
-
if (!layout.waitAutoLayout)
|
|
4507
|
-
leaf.__updateWorldBounds();
|
|
4508
|
-
},
|
|
4509
|
-
updateAllWorldOpacity(leaf) {
|
|
4510
|
-
leaf.__updateWorldOpacity();
|
|
4511
|
-
if (leaf.isBranch) {
|
|
4512
|
-
const { children } = leaf;
|
|
4513
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4514
|
-
updateAllWorldOpacity(children[i]);
|
|
4515
|
-
}
|
|
4516
|
-
}
|
|
4517
|
-
},
|
|
4518
|
-
updateAllChange(leaf) {
|
|
4519
|
-
updateAllWorldOpacity(leaf);
|
|
4520
|
-
leaf.__updateChange();
|
|
4521
|
-
if (leaf.isBranch) {
|
|
4522
|
-
const { children } = leaf;
|
|
4523
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4524
|
-
updateAllChange(children[i]);
|
|
4525
|
-
}
|
|
4526
|
-
}
|
|
4527
|
-
},
|
|
4528
|
-
worldHittable(t) {
|
|
4529
|
-
while (t) {
|
|
4530
|
-
if (!t.__.hittable)
|
|
4531
|
-
return false;
|
|
4532
|
-
t = t.parent;
|
|
4533
|
-
}
|
|
4534
|
-
return true;
|
|
4535
|
-
},
|
|
4536
|
-
moveWorld(t, x, y) {
|
|
4537
|
-
const local = { x, y };
|
|
4538
|
-
if (t.parent)
|
|
4539
|
-
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
4540
|
-
L.moveLocal(t, local.x, local.y);
|
|
4541
|
-
},
|
|
4542
|
-
moveLocal(t, x, y = 0) {
|
|
4543
|
-
t.x += x;
|
|
4544
|
-
t.y += y;
|
|
4545
|
-
},
|
|
4546
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
4547
|
-
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
4548
|
-
},
|
|
4549
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4550
|
-
copy$1(matrix, t.__localMatrix);
|
|
4551
|
-
scaleOfOuter(matrix, origin, scaleX, scaleY);
|
|
4552
|
-
moveByMatrix(t, matrix);
|
|
4553
|
-
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4554
|
-
},
|
|
4555
|
-
rotateOfWorld(t, origin, angle) {
|
|
4556
|
-
L.rotateOfLocal(t, getTempLocal(t, origin), angle);
|
|
4557
|
-
},
|
|
4558
|
-
rotateOfLocal(t, origin, angle) {
|
|
4559
|
-
copy$1(matrix, t.__localMatrix);
|
|
4560
|
-
rotateOfOuter(matrix, origin, angle);
|
|
4561
|
-
moveByMatrix(t, matrix);
|
|
4562
|
-
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4563
|
-
},
|
|
4564
|
-
skewOfWorld(t, origin, skewX, skewY, resize) {
|
|
4565
|
-
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
|
|
4566
|
-
},
|
|
4567
|
-
skewOfLocal(t, origin, skewX, skewY = 0, resize) {
|
|
4568
|
-
copy$1(matrix, t.__localMatrix);
|
|
4569
|
-
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4570
|
-
L.setTransform(t, matrix, resize);
|
|
4571
|
-
},
|
|
4572
|
-
transformWorld(t, transform, resize) {
|
|
4573
|
-
copy$1(matrix, t.worldTransform);
|
|
4574
|
-
multiplyParent$1(matrix, transform);
|
|
4575
|
-
if (t.parent)
|
|
4576
|
-
divideParent(matrix, t.parent.worldTransform);
|
|
4577
|
-
L.setTransform(t, matrix, resize);
|
|
4578
|
-
},
|
|
4579
|
-
transform(t, transform, resize) {
|
|
4580
|
-
copy$1(matrix, t.localTransform);
|
|
4581
|
-
multiplyParent$1(matrix, transform);
|
|
4582
|
-
L.setTransform(t, matrix, resize);
|
|
4583
|
-
},
|
|
4584
|
-
setTransform(t, transform, resize) {
|
|
4585
|
-
const layout = getLayout(transform);
|
|
4586
|
-
if (resize) {
|
|
4587
|
-
t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
|
|
4588
|
-
delete layout.scaleX;
|
|
4589
|
-
delete layout.scaleY;
|
|
4590
|
-
}
|
|
4591
|
-
t.set(layout);
|
|
4592
|
-
},
|
|
4593
|
-
drop(t, parent, index, resize) {
|
|
4594
|
-
copy$1(matrix, t.worldTransform);
|
|
4595
|
-
divideParent(matrix, parent.worldTransform);
|
|
4596
|
-
t.setTransform(matrix, resize);
|
|
4597
|
-
parent.add(t, index);
|
|
4598
|
-
},
|
|
4599
|
-
hasParent(p, parent) {
|
|
4600
|
-
if (!parent)
|
|
4601
|
-
return false;
|
|
4602
|
-
while (p) {
|
|
4603
|
-
if (parent === p)
|
|
4604
|
-
return true;
|
|
4605
|
-
p = p.parent;
|
|
4606
|
-
}
|
|
4607
|
-
},
|
|
4608
|
-
hasParentAutoLayout(p) {
|
|
4609
|
-
while (p.parent) {
|
|
4610
|
-
p = p.parent;
|
|
4611
|
-
if (p.__hasAutoLayout)
|
|
4612
|
-
return true;
|
|
4613
|
-
}
|
|
4614
|
-
}
|
|
4615
|
-
};
|
|
4616
|
-
const L = LeafHelper;
|
|
4617
|
-
const { updateAllMatrix: updateAllMatrix$1, updateMatrix: updateMatrix$1, updateAllWorldOpacity, updateAllChange } = L;
|
|
4618
|
-
function moveByMatrix(t, matrix) {
|
|
4619
|
-
const { e, f } = t.__localMatrix;
|
|
4620
|
-
t.x += matrix.e - e;
|
|
4621
|
-
t.y += matrix.f - f;
|
|
4622
|
-
}
|
|
4623
|
-
function getTempLocal(t, world) {
|
|
4624
|
-
t.__layout.update();
|
|
4625
|
-
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
4634
|
+
PropertyEvent.CHANGE = 'property.change';
|
|
4635
|
+
PropertyEvent.LEAFER_CHANGE = 'property.leafer_change';
|
|
4636
|
+
|
|
4637
|
+
class ImageEvent extends Event {
|
|
4638
|
+
constructor(type, data) {
|
|
4639
|
+
super(type);
|
|
4640
|
+
Object.assign(this, data);
|
|
4641
|
+
}
|
|
4626
4642
|
}
|
|
4643
|
+
ImageEvent.LOAD = 'image.load';
|
|
4644
|
+
ImageEvent.LOADED = 'image.loaded';
|
|
4645
|
+
ImageEvent.ERROR = 'image.error';
|
|
4627
4646
|
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
},
|
|
4632
|
-
localBoxBounds(target) {
|
|
4633
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4634
|
-
},
|
|
4635
|
-
localStrokeBounds(target) {
|
|
4636
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4637
|
-
},
|
|
4638
|
-
localRenderBounds(target) {
|
|
4639
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4640
|
-
},
|
|
4641
|
-
maskLocalBoxBounds(target) {
|
|
4642
|
-
return target.__.mask ? target.__localBoxBounds : null;
|
|
4643
|
-
},
|
|
4644
|
-
maskLocalStrokeBounds(target) {
|
|
4645
|
-
return target.__.mask ? target.__layout.localStrokeBounds : null;
|
|
4646
|
-
},
|
|
4647
|
-
maskLocalRenderBounds(target) {
|
|
4648
|
-
return target.__.mask ? target.__layout.localRenderBounds : null;
|
|
4649
|
-
},
|
|
4650
|
-
excludeRenderBounds(child, options) {
|
|
4651
|
-
if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
|
|
4647
|
+
class ResizeEvent extends Event {
|
|
4648
|
+
get bigger() {
|
|
4649
|
+
if (!this.old)
|
|
4652
4650
|
return true;
|
|
4653
|
-
|
|
4651
|
+
const { width, height } = this.old;
|
|
4652
|
+
return this.width >= width && this.height >= height;
|
|
4653
|
+
}
|
|
4654
|
+
get smaller() {
|
|
4655
|
+
return !this.bigger;
|
|
4656
|
+
}
|
|
4657
|
+
get samePixelRatio() {
|
|
4658
|
+
if (!this.old)
|
|
4654
4659
|
return true;
|
|
4655
|
-
return
|
|
4660
|
+
return this.pixelRatio === this.old.pixelRatio;
|
|
4656
4661
|
}
|
|
4657
|
-
|
|
4662
|
+
constructor(size, oldSize) {
|
|
4663
|
+
if (typeof size === 'object') {
|
|
4664
|
+
super(ResizeEvent.RESIZE);
|
|
4665
|
+
Object.assign(this, size);
|
|
4666
|
+
}
|
|
4667
|
+
else {
|
|
4668
|
+
super(size);
|
|
4669
|
+
}
|
|
4670
|
+
this.old = oldSize;
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
ResizeEvent.RESIZE = 'resize';
|
|
4658
4674
|
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
}
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4675
|
+
class WatchEvent extends Event {
|
|
4676
|
+
constructor(type, data) {
|
|
4677
|
+
super(type);
|
|
4678
|
+
this.data = data;
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
WatchEvent.REQUEST = 'watch.request';
|
|
4682
|
+
WatchEvent.DATA = 'watch.data';
|
|
4683
|
+
|
|
4684
|
+
class LayoutEvent extends Event {
|
|
4685
|
+
constructor(type, data, times) {
|
|
4686
|
+
super(type);
|
|
4687
|
+
if (data) {
|
|
4688
|
+
this.data = data;
|
|
4689
|
+
this.times = times;
|
|
4676
4690
|
}
|
|
4677
|
-
}
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
LayoutEvent.CHECK_UPDATE = 'layout.check_update';
|
|
4694
|
+
LayoutEvent.REQUEST = 'layout.request';
|
|
4695
|
+
LayoutEvent.START = 'layout.start';
|
|
4696
|
+
LayoutEvent.BEFORE = 'layout.before';
|
|
4697
|
+
LayoutEvent.LAYOUT = 'layout';
|
|
4698
|
+
LayoutEvent.AFTER = 'layout.after';
|
|
4699
|
+
LayoutEvent.AGAIN = 'layout.again';
|
|
4700
|
+
LayoutEvent.END = 'layout.end';
|
|
4701
|
+
|
|
4702
|
+
class AnimateEvent extends Event {
|
|
4703
|
+
}
|
|
4704
|
+
AnimateEvent.FRAME = 'animate.frame';
|
|
4705
|
+
|
|
4706
|
+
class RenderEvent extends Event {
|
|
4707
|
+
constructor(type, times, bounds, options) {
|
|
4708
|
+
super(type);
|
|
4709
|
+
if (times)
|
|
4710
|
+
this.times = times;
|
|
4711
|
+
if (bounds) {
|
|
4712
|
+
this.renderBounds = bounds;
|
|
4713
|
+
this.renderOptions = options;
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
RenderEvent.REQUEST = 'render.request';
|
|
4718
|
+
RenderEvent.START = 'render.start';
|
|
4719
|
+
RenderEvent.BEFORE = 'render.before';
|
|
4720
|
+
RenderEvent.RENDER = 'render';
|
|
4721
|
+
RenderEvent.AFTER = 'render.after';
|
|
4722
|
+
RenderEvent.AGAIN = 'render.again';
|
|
4723
|
+
RenderEvent.END = 'render.end';
|
|
4724
|
+
RenderEvent.NEXT = 'render.next';
|
|
4725
|
+
|
|
4726
|
+
class LeaferEvent extends Event {
|
|
4727
|
+
}
|
|
4728
|
+
LeaferEvent.START = 'leafer.start';
|
|
4729
|
+
LeaferEvent.BEFORE_READY = 'leafer.before_ready';
|
|
4730
|
+
LeaferEvent.READY = 'leafer.ready';
|
|
4731
|
+
LeaferEvent.AFTER_READY = 'leafer.after_ready';
|
|
4732
|
+
LeaferEvent.VIEW_READY = 'leafer.view_ready';
|
|
4733
|
+
LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
|
|
4734
|
+
LeaferEvent.STOP = 'leafer.stop';
|
|
4735
|
+
LeaferEvent.RESTART = 'leafer.restart';
|
|
4736
|
+
LeaferEvent.END = 'leafer.end';
|
|
4737
|
+
|
|
4738
|
+
const LeafDataProxy = {
|
|
4739
|
+
__setAttr(name, newValue) {
|
|
4740
|
+
if (this.leafer && this.leafer.created) {
|
|
4741
|
+
const oldValue = this.__.__getInput(name);
|
|
4742
|
+
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
4743
|
+
this.__[name] = newValue;
|
|
4744
|
+
if (this.__proxyData)
|
|
4745
|
+
this.setProxyAttr(name, newValue);
|
|
4746
|
+
const { CHANGE } = PropertyEvent;
|
|
4747
|
+
const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
|
|
4748
|
+
if (this.isLeafer) {
|
|
4749
|
+
this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
|
|
4685
4750
|
}
|
|
4686
4751
|
else {
|
|
4687
|
-
|
|
4752
|
+
if (this.hasEvent(CHANGE))
|
|
4753
|
+
this.emitEvent(event);
|
|
4688
4754
|
}
|
|
4755
|
+
this.leafer.emitEvent(event);
|
|
4689
4756
|
}
|
|
4690
4757
|
}
|
|
4691
4758
|
else {
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
}
|
|
4696
|
-
}
|
|
4697
|
-
},
|
|
4698
|
-
pushAllBranchStack(branch, pushList) {
|
|
4699
|
-
let start = pushList.length;
|
|
4700
|
-
const { children } = branch;
|
|
4701
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
4702
|
-
if (children[i].isBranch) {
|
|
4703
|
-
pushList.push(children[i]);
|
|
4704
|
-
}
|
|
4705
|
-
}
|
|
4706
|
-
for (let i = start, len = pushList.length; i < len; i++) {
|
|
4707
|
-
pushAllBranchStack(pushList[i], pushList);
|
|
4759
|
+
this.__[name] = newValue;
|
|
4760
|
+
if (this.__proxyData)
|
|
4761
|
+
this.setProxyAttr(name, newValue);
|
|
4708
4762
|
}
|
|
4709
4763
|
},
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
},
|
|
4715
|
-
updateBoundsByBranchStack(branchStack, exclude) {
|
|
4716
|
-
let branch, children;
|
|
4717
|
-
for (let i = branchStack.length - 1; i > -1; i--) {
|
|
4718
|
-
branch = branchStack[i];
|
|
4719
|
-
children = branch.children;
|
|
4720
|
-
for (let j = 0, len = children.length; j < len; j++) {
|
|
4721
|
-
updateBounds$1(children[j]);
|
|
4722
|
-
}
|
|
4723
|
-
if (exclude && exclude === branch)
|
|
4724
|
-
continue;
|
|
4725
|
-
updateBounds$1(branch);
|
|
4726
|
-
}
|
|
4764
|
+
__getAttr(name) {
|
|
4765
|
+
if (this.__proxyData)
|
|
4766
|
+
return this.getProxyAttr(name);
|
|
4767
|
+
return this.__.__get(name);
|
|
4727
4768
|
}
|
|
4728
4769
|
};
|
|
4729
|
-
const { pushAllChildBranch, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
|
|
4730
4770
|
|
|
4731
|
-
const
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4771
|
+
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4772
|
+
const { toPoint, tempPoint } = AroundHelper;
|
|
4773
|
+
const LeafMatrix = {
|
|
4774
|
+
__updateWorldMatrix() {
|
|
4775
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4776
|
+
},
|
|
4777
|
+
__updateLocalMatrix() {
|
|
4778
|
+
if (this.__local) {
|
|
4779
|
+
const layout = this.__layout, local = this.__local, data = this.__;
|
|
4780
|
+
if (layout.affectScaleOrRotation) {
|
|
4781
|
+
if (layout.scaleChanged || layout.rotationChanged) {
|
|
4782
|
+
setLayout(local, data, null, layout.affectRotation);
|
|
4783
|
+
layout.scaleChanged = layout.rotationChanged = false;
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
local.e = data.x;
|
|
4787
|
+
local.f = data.y;
|
|
4788
|
+
if (data.around) {
|
|
4789
|
+
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4790
|
+
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4737
4791
|
}
|
|
4738
|
-
wait.length === len ? wait.length = 0 : wait.splice(0, len);
|
|
4739
4792
|
}
|
|
4793
|
+
this.__layout.matrixChanged = false;
|
|
4740
4794
|
}
|
|
4741
4795
|
};
|
|
4742
4796
|
|
|
@@ -4953,7 +5007,7 @@ const { LEAF, create } = IncrementId;
|
|
|
4953
5007
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
4954
5008
|
const { toOuterOf } = BoundsHelper;
|
|
4955
5009
|
const { tempToOuterOf, copy } = PointHelper;
|
|
4956
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, transform, setTransform, drop } = LeafHelper;
|
|
5010
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getRelativeWorld, drop } = LeafHelper;
|
|
4957
5011
|
exports.Leaf = class Leaf {
|
|
4958
5012
|
get tag() { return this.__tag; }
|
|
4959
5013
|
set tag(_value) { }
|
|
@@ -4991,21 +5045,31 @@ exports.Leaf = class Leaf {
|
|
|
4991
5045
|
this.__layout = new this.__LayoutProcessor(this);
|
|
4992
5046
|
if (this.__level)
|
|
4993
5047
|
this.resetCustom();
|
|
4994
|
-
if (data)
|
|
5048
|
+
if (data) {
|
|
5049
|
+
if (data.__)
|
|
5050
|
+
data = data.toJSON();
|
|
4995
5051
|
data.children ? this.set(data) : Object.assign(this, data);
|
|
5052
|
+
}
|
|
4996
5053
|
}
|
|
4997
5054
|
resetCustom() {
|
|
4998
5055
|
this.__hasMask = this.__hasEraser = null;
|
|
4999
5056
|
this.forceUpdate();
|
|
5000
5057
|
}
|
|
5001
|
-
waitParent(item) {
|
|
5058
|
+
waitParent(item, bind) {
|
|
5059
|
+
if (bind)
|
|
5060
|
+
item = item.bind(bind);
|
|
5002
5061
|
this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
|
|
5003
5062
|
}
|
|
5004
|
-
waitLeafer(item) {
|
|
5063
|
+
waitLeafer(item, bind) {
|
|
5064
|
+
if (bind)
|
|
5065
|
+
item = item.bind(bind);
|
|
5005
5066
|
this.leafer ? item() : (this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item]);
|
|
5006
5067
|
}
|
|
5007
|
-
nextRender(item, off) {
|
|
5008
|
-
this.leafer ? this.leafer.nextRender(item, off) : this.waitLeafer(() => this.leafer.nextRender(item, off));
|
|
5068
|
+
nextRender(item, bind, off) {
|
|
5069
|
+
this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
|
|
5070
|
+
}
|
|
5071
|
+
removeNextRender(item) {
|
|
5072
|
+
this.nextRender(item, null, 'off');
|
|
5009
5073
|
}
|
|
5010
5074
|
__bindLeafer(leafer) {
|
|
5011
5075
|
if (this.isLeafer) {
|
|
@@ -5042,6 +5106,7 @@ exports.Leaf = class Leaf {
|
|
|
5042
5106
|
getProxyAttr(_attrName) { return undefined; }
|
|
5043
5107
|
find(_condition, _options) { return undefined; }
|
|
5044
5108
|
findOne(_condition, _options) { return undefined; }
|
|
5109
|
+
focus(_value) { }
|
|
5045
5110
|
forceUpdate(attrName) {
|
|
5046
5111
|
if (attrName === undefined)
|
|
5047
5112
|
attrName = 'width';
|
|
@@ -5097,6 +5162,9 @@ exports.Leaf = class Leaf {
|
|
|
5097
5162
|
return this.__world.f;
|
|
5098
5163
|
return this.getLayoutBounds()[attrName];
|
|
5099
5164
|
}
|
|
5165
|
+
getTransform(relative) {
|
|
5166
|
+
return this.__layout.getTransform(relative || 'local');
|
|
5167
|
+
}
|
|
5100
5168
|
getBounds(type, relative) {
|
|
5101
5169
|
return this.__layout.getBounds(type, relative);
|
|
5102
5170
|
}
|
|
@@ -5106,6 +5174,12 @@ exports.Leaf = class Leaf {
|
|
|
5106
5174
|
getLayoutPoints(type, relative) {
|
|
5107
5175
|
return this.__layout.getLayoutPoints(type, relative);
|
|
5108
5176
|
}
|
|
5177
|
+
getWorldBounds(inner, relative, change) {
|
|
5178
|
+
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
5179
|
+
const to = change ? inner : {};
|
|
5180
|
+
toOuterOf(inner, matrix, to);
|
|
5181
|
+
return to;
|
|
5182
|
+
}
|
|
5109
5183
|
worldToLocal(world, to, distance, relative) {
|
|
5110
5184
|
if (this.parent) {
|
|
5111
5185
|
this.parent.worldToInner(world, to, distance, relative);
|
|
@@ -5188,6 +5262,21 @@ exports.Leaf = class Leaf {
|
|
|
5188
5262
|
skewOf(origin, skewX, skewY, resize) {
|
|
5189
5263
|
skewOfLocal(this, tempToOuterOf(origin, this.localTransform), skewX, skewY, resize);
|
|
5190
5264
|
}
|
|
5265
|
+
transformWorld(worldTransform, resize) {
|
|
5266
|
+
transformWorld(this, worldTransform, resize);
|
|
5267
|
+
}
|
|
5268
|
+
moveWorld(x, y) {
|
|
5269
|
+
moveWorld(this, x, y);
|
|
5270
|
+
}
|
|
5271
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
|
|
5272
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
|
|
5273
|
+
}
|
|
5274
|
+
rotateOfWorld(worldOrigin, rotation) {
|
|
5275
|
+
rotateOfWorld(this, worldOrigin, rotation);
|
|
5276
|
+
}
|
|
5277
|
+
skewOfWorld(worldOrigin, skewX, skewY, resize) {
|
|
5278
|
+
skewOfWorld(this, worldOrigin, skewX, skewY, resize);
|
|
5279
|
+
}
|
|
5191
5280
|
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
5192
5281
|
this.scaleX *= scaleX;
|
|
5193
5282
|
this.scaleY *= scaleY;
|
|
@@ -5319,7 +5408,8 @@ exports.Branch = class Branch extends exports.Leaf {
|
|
|
5319
5408
|
index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5320
5409
|
if (child.isBranch)
|
|
5321
5410
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5322
|
-
child.__layout.
|
|
5411
|
+
child.__layout.boxChanged || child.__layout.boxChange();
|
|
5412
|
+
child.__layout.matrixChanged || child.__layout.matrixChange();
|
|
5323
5413
|
if (child.__parentWait)
|
|
5324
5414
|
WaitHelper.run(child.__parentWait);
|
|
5325
5415
|
if (this.leafer) {
|
|
@@ -5643,6 +5733,7 @@ exports.naturalBoundsType = naturalBoundsType;
|
|
|
5643
5733
|
exports.opacityType = opacityType;
|
|
5644
5734
|
exports.pathInputType = pathInputType;
|
|
5645
5735
|
exports.pathType = pathType;
|
|
5736
|
+
exports.pen = pen;
|
|
5646
5737
|
exports.positionType = positionType;
|
|
5647
5738
|
exports.registerUI = registerUI;
|
|
5648
5739
|
exports.registerUIEvent = registerUIEvent;
|