@leafer-draw/worker 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/dist/worker.esm.js +37 -19
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +722 -535
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +719 -536
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.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.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.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$5, 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$5(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$5(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$5(matrix, t.__localMatrix);
|
|
4022
|
+
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4023
|
+
L.setTransform(t, matrix, resize);
|
|
4024
|
+
},
|
|
4025
|
+
transformWorld(t, transform, resize) {
|
|
4026
|
+
copy$5(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$5(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$5(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$4 } = 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$4(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
|
}
|
|
@@ -4381,363 +4707,91 @@ var LeaferUI = (function (exports) {
|
|
|
4381
4707
|
class RenderEvent extends Event {
|
|
4382
4708
|
constructor(type, times, bounds, options) {
|
|
4383
4709
|
super(type);
|
|
4384
|
-
if (times)
|
|
4385
|
-
this.times = times;
|
|
4386
|
-
if (bounds) {
|
|
4387
|
-
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$4, 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$4(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$4(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$4(matrix, t.__localMatrix);
|
|
4570
|
-
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4571
|
-
L.setTransform(t, matrix, resize);
|
|
4572
|
-
},
|
|
4573
|
-
transformWorld(t, transform, resize) {
|
|
4574
|
-
copy$4(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$4(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$4(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;
|
|
4710
|
+
if (times)
|
|
4711
|
+
this.times = times;
|
|
4712
|
+
if (bounds) {
|
|
4713
|
+
this.renderBounds = bounds;
|
|
4714
|
+
this.renderOptions = options;
|
|
4614
4715
|
}
|
|
4615
4716
|
}
|
|
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
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';
|
|
4628
4726
|
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
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;
|
|
4657
|
-
}
|
|
4658
|
-
};
|
|
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';
|
|
4659
4738
|
|
|
4660
|
-
const
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
branch.__tempNumber = 1;
|
|
4673
|
-
leafList.add(branch);
|
|
4674
|
-
pushAllChildBranch$1(branch, leafList);
|
|
4675
|
-
}
|
|
4676
|
-
}
|
|
4677
|
-
}
|
|
4678
|
-
},
|
|
4679
|
-
pushAllParent(leaf, leafList) {
|
|
4680
|
-
const { keys } = leafList;
|
|
4681
|
-
if (keys) {
|
|
4682
|
-
while (leaf.parent) {
|
|
4683
|
-
if (keys[leaf.parent.innerId] === undefined) {
|
|
4684
|
-
leafList.add(leaf.parent);
|
|
4685
|
-
leaf = leaf.parent;
|
|
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$3 } = 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) {
|
|
@@ -6051,6 +6141,10 @@ var LeaferUI = (function (exports) {
|
|
|
6051
6141
|
}
|
|
6052
6142
|
else {
|
|
6053
6143
|
this.requestLayout();
|
|
6144
|
+
if (this.ignore) {
|
|
6145
|
+
this.ignore = this.rendering = false;
|
|
6146
|
+
return;
|
|
6147
|
+
}
|
|
6054
6148
|
this.emitRender(RenderEvent.BEFORE);
|
|
6055
6149
|
if (this.config.usePartRender && this.totalTimes > 1) {
|
|
6056
6150
|
this.partRender();
|
|
@@ -6198,9 +6292,7 @@ var LeaferUI = (function (exports) {
|
|
|
6198
6292
|
if (this.target) {
|
|
6199
6293
|
this.stop();
|
|
6200
6294
|
this.__removeListenEvents();
|
|
6201
|
-
this.target = null;
|
|
6202
|
-
this.canvas = null;
|
|
6203
|
-
this.config = null;
|
|
6295
|
+
this.target = this.canvas = this.config = null;
|
|
6204
6296
|
}
|
|
6205
6297
|
}
|
|
6206
6298
|
}
|
|
@@ -6214,14 +6306,36 @@ var LeaferUI = (function (exports) {
|
|
|
6214
6306
|
});
|
|
6215
6307
|
Platform.layout = Layouter.fullLayout;
|
|
6216
6308
|
|
|
6309
|
+
const TextConvert = {};
|
|
6310
|
+
const ColorConvert = {};
|
|
6311
|
+
const PathArrow = {};
|
|
6312
|
+
const Paint = {};
|
|
6313
|
+
const PaintImage = {};
|
|
6314
|
+
const PaintGradient = {};
|
|
6315
|
+
const Effect = {};
|
|
6316
|
+
const Export = {};
|
|
6317
|
+
const State = {};
|
|
6318
|
+
|
|
6319
|
+
function stateType(defaultValue) {
|
|
6320
|
+
return (target, key) => {
|
|
6321
|
+
const stateType = key + 'Style';
|
|
6322
|
+
defineLeafAttr(target, key, defaultValue, {
|
|
6323
|
+
set(value) {
|
|
6324
|
+
this.__setAttr(key, value);
|
|
6325
|
+
this.waitLeafer(() => { if (State.setStyle)
|
|
6326
|
+
State.setStyle(this, stateType, value); });
|
|
6327
|
+
}
|
|
6328
|
+
});
|
|
6329
|
+
};
|
|
6330
|
+
}
|
|
6217
6331
|
function arrowType(defaultValue) {
|
|
6218
6332
|
return (target, key) => {
|
|
6219
6333
|
defineLeafAttr(target, key, defaultValue, {
|
|
6220
6334
|
set(value) {
|
|
6221
6335
|
this.__setAttr(key, value);
|
|
6222
|
-
doStrokeType(this);
|
|
6223
6336
|
const data = this.__;
|
|
6224
6337
|
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6338
|
+
doStrokeType(this);
|
|
6225
6339
|
}
|
|
6226
6340
|
});
|
|
6227
6341
|
};
|
|
@@ -6249,15 +6363,16 @@ var LeaferUI = (function (exports) {
|
|
|
6249
6363
|
});
|
|
6250
6364
|
};
|
|
6251
6365
|
}
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6366
|
+
function zoomLayerType() {
|
|
6367
|
+
return (target, key) => {
|
|
6368
|
+
const privateKey = '_' + key;
|
|
6369
|
+
defineKey(target, key, {
|
|
6370
|
+
set(value) { if (this.isLeafer)
|
|
6371
|
+
this[privateKey] = value; },
|
|
6372
|
+
get() { return this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer; }
|
|
6373
|
+
});
|
|
6374
|
+
};
|
|
6375
|
+
}
|
|
6261
6376
|
|
|
6262
6377
|
const { parse } = PathConvert;
|
|
6263
6378
|
const emptyPaint = {};
|
|
@@ -6266,7 +6381,7 @@ var LeaferUI = (function (exports) {
|
|
|
6266
6381
|
get __strokeWidth() {
|
|
6267
6382
|
const { strokeWidth, strokeWidthFixed } = this;
|
|
6268
6383
|
if (strokeWidthFixed) {
|
|
6269
|
-
let { scaleX } = this.__leaf.
|
|
6384
|
+
let { scaleX } = this.__leaf.__nowWorld;
|
|
6270
6385
|
if (scaleX < 0)
|
|
6271
6386
|
scaleX = -scaleX;
|
|
6272
6387
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
@@ -6540,18 +6655,11 @@ var LeaferUI = (function (exports) {
|
|
|
6540
6655
|
}
|
|
6541
6656
|
},
|
|
6542
6657
|
__drawFast(canvas, options) {
|
|
6543
|
-
|
|
6544
|
-
this.__drawRenderPath(canvas);
|
|
6545
|
-
if (fill)
|
|
6546
|
-
Paint.fill(fill, this, canvas);
|
|
6547
|
-
if (__drawAfterFill)
|
|
6548
|
-
this.__drawAfterFill(canvas, options);
|
|
6549
|
-
if (stroke)
|
|
6550
|
-
Paint.stroke(stroke, this, canvas);
|
|
6658
|
+
drawFast(this, canvas, options);
|
|
6551
6659
|
},
|
|
6552
6660
|
__draw(canvas, options) {
|
|
6553
|
-
|
|
6554
|
-
|
|
6661
|
+
const data = this.__;
|
|
6662
|
+
if (data.__complex) {
|
|
6555
6663
|
if (data.__needComputePaint)
|
|
6556
6664
|
data.__computePaint();
|
|
6557
6665
|
const { fill, stroke, __drawAfterFill } = data;
|
|
@@ -6584,7 +6692,12 @@ var LeaferUI = (function (exports) {
|
|
|
6584
6692
|
}
|
|
6585
6693
|
}
|
|
6586
6694
|
else {
|
|
6587
|
-
|
|
6695
|
+
if (data.__pathInputed) {
|
|
6696
|
+
drawFast(this, canvas, options);
|
|
6697
|
+
}
|
|
6698
|
+
else {
|
|
6699
|
+
this.__drawFast(canvas, options);
|
|
6700
|
+
}
|
|
6588
6701
|
}
|
|
6589
6702
|
},
|
|
6590
6703
|
__renderShape(canvas, options) {
|
|
@@ -6599,6 +6712,16 @@ var LeaferUI = (function (exports) {
|
|
|
6599
6712
|
}
|
|
6600
6713
|
}
|
|
6601
6714
|
};
|
|
6715
|
+
function drawFast(ui, canvas, options) {
|
|
6716
|
+
const { fill, stroke, __drawAfterFill } = ui.__;
|
|
6717
|
+
ui.__drawRenderPath(canvas);
|
|
6718
|
+
if (fill)
|
|
6719
|
+
Paint.fill(fill, ui, canvas);
|
|
6720
|
+
if (__drawAfterFill)
|
|
6721
|
+
ui.__drawAfterFill(canvas, options);
|
|
6722
|
+
if (stroke)
|
|
6723
|
+
Paint.stroke(stroke, ui, canvas);
|
|
6724
|
+
}
|
|
6602
6725
|
|
|
6603
6726
|
const RectRender = {
|
|
6604
6727
|
__drawFast(canvas, options) {
|
|
@@ -6647,6 +6770,10 @@ var LeaferUI = (function (exports) {
|
|
|
6647
6770
|
const { scaleX, scaleY } = this;
|
|
6648
6771
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
6649
6772
|
}
|
|
6773
|
+
get pen() {
|
|
6774
|
+
pen.set(this.path = this.__.path || []);
|
|
6775
|
+
return pen;
|
|
6776
|
+
}
|
|
6650
6777
|
constructor(data) {
|
|
6651
6778
|
super(data);
|
|
6652
6779
|
}
|
|
@@ -6655,7 +6782,7 @@ var LeaferUI = (function (exports) {
|
|
|
6655
6782
|
Object.assign(this, data);
|
|
6656
6783
|
}
|
|
6657
6784
|
get(name) {
|
|
6658
|
-
return name ? this.__.__getInput(name) : this.__.__getInputData();
|
|
6785
|
+
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
6659
6786
|
}
|
|
6660
6787
|
createProxyData() { return undefined; }
|
|
6661
6788
|
find(_condition, _options) { return undefined; }
|
|
@@ -6664,10 +6791,11 @@ var LeaferUI = (function (exports) {
|
|
|
6664
6791
|
this.__layout.update();
|
|
6665
6792
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
6666
6793
|
if (!path) {
|
|
6667
|
-
path = [];
|
|
6668
6794
|
const { width, height } = this.boxBounds;
|
|
6669
|
-
if (width || height)
|
|
6670
|
-
|
|
6795
|
+
if (width || height) {
|
|
6796
|
+
pen.set(path = []);
|
|
6797
|
+
this.__drawPathByBox(pen);
|
|
6798
|
+
}
|
|
6671
6799
|
}
|
|
6672
6800
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
6673
6801
|
}
|
|
@@ -6739,6 +6867,9 @@ var LeaferUI = (function (exports) {
|
|
|
6739
6867
|
__decorate([
|
|
6740
6868
|
dataProcessor(UIData)
|
|
6741
6869
|
], exports.UI.prototype, "__", void 0);
|
|
6870
|
+
__decorate([
|
|
6871
|
+
zoomLayerType()
|
|
6872
|
+
], exports.UI.prototype, "zoomLayer", void 0);
|
|
6742
6873
|
__decorate([
|
|
6743
6874
|
dataType('')
|
|
6744
6875
|
], exports.UI.prototype, "id", void 0);
|
|
@@ -6757,6 +6888,12 @@ var LeaferUI = (function (exports) {
|
|
|
6757
6888
|
__decorate([
|
|
6758
6889
|
opacityType(true)
|
|
6759
6890
|
], exports.UI.prototype, "visible", void 0);
|
|
6891
|
+
__decorate([
|
|
6892
|
+
stateType(false)
|
|
6893
|
+
], exports.UI.prototype, "selected", void 0);
|
|
6894
|
+
__decorate([
|
|
6895
|
+
stateType(false)
|
|
6896
|
+
], exports.UI.prototype, "disabled", void 0);
|
|
6760
6897
|
__decorate([
|
|
6761
6898
|
dataType(false)
|
|
6762
6899
|
], exports.UI.prototype, "locked", void 0);
|
|
@@ -6904,6 +7041,24 @@ var LeaferUI = (function (exports) {
|
|
|
6904
7041
|
__decorate([
|
|
6905
7042
|
effectType()
|
|
6906
7043
|
], exports.UI.prototype, "grayscale", void 0);
|
|
7044
|
+
__decorate([
|
|
7045
|
+
dataType()
|
|
7046
|
+
], exports.UI.prototype, "normalStyle", void 0);
|
|
7047
|
+
__decorate([
|
|
7048
|
+
dataType()
|
|
7049
|
+
], exports.UI.prototype, "hoverStyle", void 0);
|
|
7050
|
+
__decorate([
|
|
7051
|
+
dataType()
|
|
7052
|
+
], exports.UI.prototype, "pressStyle", void 0);
|
|
7053
|
+
__decorate([
|
|
7054
|
+
dataType()
|
|
7055
|
+
], exports.UI.prototype, "focusStyle", void 0);
|
|
7056
|
+
__decorate([
|
|
7057
|
+
dataType()
|
|
7058
|
+
], exports.UI.prototype, "selectedStyle", void 0);
|
|
7059
|
+
__decorate([
|
|
7060
|
+
dataType()
|
|
7061
|
+
], exports.UI.prototype, "disabledStyle", void 0);
|
|
6907
7062
|
__decorate([
|
|
6908
7063
|
rewrite(exports.Leaf.prototype.reset)
|
|
6909
7064
|
], exports.UI.prototype, "reset", null);
|
|
@@ -6940,7 +7095,7 @@ var LeaferUI = (function (exports) {
|
|
|
6940
7095
|
super.set(data);
|
|
6941
7096
|
let child;
|
|
6942
7097
|
children.forEach(childData => {
|
|
6943
|
-
child = UICreator.get(childData.tag, childData);
|
|
7098
|
+
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
6944
7099
|
this.add(child);
|
|
6945
7100
|
});
|
|
6946
7101
|
data.children = children;
|
|
@@ -6989,7 +7144,6 @@ var LeaferUI = (function (exports) {
|
|
|
6989
7144
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
6990
7145
|
constructor(userConfig, data) {
|
|
6991
7146
|
super(data);
|
|
6992
|
-
this.zoomLayer = this;
|
|
6993
7147
|
this.config = {
|
|
6994
7148
|
type: 'design',
|
|
6995
7149
|
start: true,
|
|
@@ -7002,7 +7156,6 @@ var LeaferUI = (function (exports) {
|
|
|
7002
7156
|
move: {
|
|
7003
7157
|
holdSpaceKey: true,
|
|
7004
7158
|
holdMiddleKey: true,
|
|
7005
|
-
dragOut: true,
|
|
7006
7159
|
autoDistance: 2
|
|
7007
7160
|
}
|
|
7008
7161
|
};
|
|
@@ -7133,9 +7286,6 @@ var LeaferUI = (function (exports) {
|
|
|
7133
7286
|
this.leafer = leafer;
|
|
7134
7287
|
this.__level = 1;
|
|
7135
7288
|
}
|
|
7136
|
-
setZoomLayer(zoomLayer) {
|
|
7137
|
-
this.zoomLayer = zoomLayer;
|
|
7138
|
-
}
|
|
7139
7289
|
__checkAutoLayout(config) {
|
|
7140
7290
|
if (!config.width || !config.height) {
|
|
7141
7291
|
this.autoLayout = new AutoBounds(config);
|
|
@@ -7221,13 +7371,19 @@ var LeaferUI = (function (exports) {
|
|
|
7221
7371
|
this.nextRender(() => this.interaction.updateCursor());
|
|
7222
7372
|
}
|
|
7223
7373
|
}
|
|
7224
|
-
waitReady(item) {
|
|
7374
|
+
waitReady(item, bind) {
|
|
7375
|
+
if (bind)
|
|
7376
|
+
item = item.bind(bind);
|
|
7225
7377
|
this.ready ? item() : this.__readyWait.push(item);
|
|
7226
7378
|
}
|
|
7227
|
-
waitViewReady(item) {
|
|
7379
|
+
waitViewReady(item, bind) {
|
|
7380
|
+
if (bind)
|
|
7381
|
+
item = item.bind(bind);
|
|
7228
7382
|
this.viewReady ? item() : this.__viewReadyWait.push(item);
|
|
7229
7383
|
}
|
|
7230
|
-
waitViewCompleted(item) {
|
|
7384
|
+
waitViewCompleted(item, bind) {
|
|
7385
|
+
if (bind)
|
|
7386
|
+
item = item.bind(bind);
|
|
7231
7387
|
this.__viewCompletedWait.push(item);
|
|
7232
7388
|
if (this.viewCompleted) {
|
|
7233
7389
|
this.__checkViewCompleted(false);
|
|
@@ -7237,7 +7393,9 @@ var LeaferUI = (function (exports) {
|
|
|
7237
7393
|
this.start();
|
|
7238
7394
|
}
|
|
7239
7395
|
}
|
|
7240
|
-
nextRender(item, off) {
|
|
7396
|
+
nextRender(item, bind, off) {
|
|
7397
|
+
if (bind)
|
|
7398
|
+
item = item.bind(bind);
|
|
7241
7399
|
const list = this.__nextRenderWait;
|
|
7242
7400
|
if (off) {
|
|
7243
7401
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -7251,6 +7409,15 @@ var LeaferUI = (function (exports) {
|
|
|
7251
7409
|
list.push(item);
|
|
7252
7410
|
}
|
|
7253
7411
|
}
|
|
7412
|
+
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7413
|
+
validScale(changeScale) {
|
|
7414
|
+
const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
|
|
7415
|
+
if (absScale < min)
|
|
7416
|
+
changeScale = min / scaleX;
|
|
7417
|
+
else if (absScale > max)
|
|
7418
|
+
changeScale = max / scaleX;
|
|
7419
|
+
return changeScale;
|
|
7420
|
+
}
|
|
7254
7421
|
__checkUpdateLayout() {
|
|
7255
7422
|
this.__layout.update();
|
|
7256
7423
|
}
|
|
@@ -8380,10 +8547,6 @@ var LeaferUI = (function (exports) {
|
|
|
8380
8547
|
case 'strench':
|
|
8381
8548
|
if (!sameBox)
|
|
8382
8549
|
width = box.width, height = box.height;
|
|
8383
|
-
if (box.x || box.y) {
|
|
8384
|
-
data.transform = get$3();
|
|
8385
|
-
translate(data.transform, box.x, box.y);
|
|
8386
|
-
}
|
|
8387
8550
|
break;
|
|
8388
8551
|
case 'clip':
|
|
8389
8552
|
if (offset || scaleX || rotation)
|
|
@@ -8401,6 +8564,12 @@ var LeaferUI = (function (exports) {
|
|
|
8401
8564
|
if (!sameBox || rotation)
|
|
8402
8565
|
fillOrFitMode(data, mode, box, width, height, rotation);
|
|
8403
8566
|
}
|
|
8567
|
+
if (!data.transform) {
|
|
8568
|
+
if (box.x || box.y) {
|
|
8569
|
+
data.transform = get$3();
|
|
8570
|
+
translate(data.transform, box.x, box.y);
|
|
8571
|
+
}
|
|
8572
|
+
}
|
|
8404
8573
|
data.width = width;
|
|
8405
8574
|
data.height = height;
|
|
8406
8575
|
if (opacity)
|
|
@@ -8418,8 +8587,7 @@ var LeaferUI = (function (exports) {
|
|
|
8418
8587
|
leafPaint = cache.leafPaint;
|
|
8419
8588
|
}
|
|
8420
8589
|
else {
|
|
8421
|
-
leafPaint = { type: paint.type };
|
|
8422
|
-
leafPaint.image = image;
|
|
8590
|
+
leafPaint = { type: paint.type, image };
|
|
8423
8591
|
cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
|
|
8424
8592
|
}
|
|
8425
8593
|
if (firstUse || image.loading)
|
|
@@ -8436,9 +8604,11 @@ var LeaferUI = (function (exports) {
|
|
|
8436
8604
|
onLoadError(ui, event, image.error);
|
|
8437
8605
|
}
|
|
8438
8606
|
else {
|
|
8607
|
+
ignoreRender(ui, true);
|
|
8439
8608
|
if (firstUse)
|
|
8440
8609
|
onLoad(ui, event);
|
|
8441
8610
|
leafPaint.loadId = image.load(() => {
|
|
8611
|
+
ignoreRender(ui, false);
|
|
8442
8612
|
if (!ui.destroyed) {
|
|
8443
8613
|
if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
|
|
8444
8614
|
ui.forceUpdate('surface');
|
|
@@ -8446,6 +8616,7 @@ var LeaferUI = (function (exports) {
|
|
|
8446
8616
|
}
|
|
8447
8617
|
leafPaint.loadId = null;
|
|
8448
8618
|
}, (error) => {
|
|
8619
|
+
ignoreRender(ui, false);
|
|
8449
8620
|
onLoadError(ui, event, error);
|
|
8450
8621
|
leafPaint.loadId = null;
|
|
8451
8622
|
});
|
|
@@ -8485,11 +8656,16 @@ var LeaferUI = (function (exports) {
|
|
|
8485
8656
|
if (ui.hasEvent(type))
|
|
8486
8657
|
ui.emitEvent(new ImageEvent(type, data));
|
|
8487
8658
|
}
|
|
8659
|
+
function ignoreRender(ui, value) {
|
|
8660
|
+
const { leafer } = ui;
|
|
8661
|
+
if (leafer && leafer.viewReady)
|
|
8662
|
+
leafer.renderer.ignore = value;
|
|
8663
|
+
}
|
|
8488
8664
|
|
|
8489
8665
|
const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
|
|
8490
8666
|
const { ceil, abs: abs$1 } = Math;
|
|
8491
8667
|
function createPattern(ui, paint, pixelRatio) {
|
|
8492
|
-
let { scaleX, scaleY } = ui.
|
|
8668
|
+
let { scaleX, scaleY } = ui.__nowWorld;
|
|
8493
8669
|
const id = scaleX + '-' + scaleY;
|
|
8494
8670
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
8495
8671
|
scaleX = abs$1(scaleX);
|
|
@@ -8551,7 +8727,7 @@ var LeaferUI = (function (exports) {
|
|
|
8551
8727
|
|
|
8552
8728
|
const { abs } = Math;
|
|
8553
8729
|
function checkImage(ui, canvas, paint, allowPaint) {
|
|
8554
|
-
const { scaleX, scaleY } = ui.
|
|
8730
|
+
const { scaleX, scaleY } = ui.__nowWorld;
|
|
8555
8731
|
if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
|
|
8556
8732
|
return false;
|
|
8557
8733
|
}
|
|
@@ -8593,7 +8769,7 @@ var LeaferUI = (function (exports) {
|
|
|
8593
8769
|
if (!paint.patternTask) {
|
|
8594
8770
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
8595
8771
|
paint.patternTask = null;
|
|
8596
|
-
if (canvas.bounds.hit(ui.
|
|
8772
|
+
if (canvas.bounds.hit(ui.__nowWorld))
|
|
8597
8773
|
createPattern(ui, paint, canvas.pixelRatio);
|
|
8598
8774
|
ui.forceUpdate('surface');
|
|
8599
8775
|
}), 300);
|
|
@@ -8830,8 +9006,8 @@ var LeaferUI = (function (exports) {
|
|
|
8830
9006
|
|
|
8831
9007
|
function blur(ui, current, origin) {
|
|
8832
9008
|
const { blur } = ui.__;
|
|
8833
|
-
origin.setWorldBlur(blur * ui.
|
|
8834
|
-
origin.copyWorldToInner(current, ui.
|
|
9009
|
+
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
9010
|
+
origin.copyWorldToInner(current, ui.__nowWorld, ui.__layout.renderBounds);
|
|
8835
9011
|
origin.filter = 'none';
|
|
8836
9012
|
}
|
|
8837
9013
|
|
|
@@ -9462,10 +9638,10 @@ var LeaferUI = (function (exports) {
|
|
|
9462
9638
|
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
9463
9639
|
}
|
|
9464
9640
|
else {
|
|
9465
|
-
|
|
9641
|
+
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
9466
9642
|
scaleX = worldTransform.scaleX;
|
|
9467
9643
|
scaleY = worldTransform.scaleY;
|
|
9468
|
-
switch (
|
|
9644
|
+
switch (relative) {
|
|
9469
9645
|
case 'inner':
|
|
9470
9646
|
matrix.set(worldTransform).invert();
|
|
9471
9647
|
break;
|
|
@@ -9478,11 +9654,18 @@ var LeaferUI = (function (exports) {
|
|
|
9478
9654
|
scaleX = 1;
|
|
9479
9655
|
scaleY = 1;
|
|
9480
9656
|
break;
|
|
9657
|
+
case 'page':
|
|
9658
|
+
relative = leaf.leafer;
|
|
9659
|
+
default:
|
|
9660
|
+
matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert();
|
|
9661
|
+
const l = relative.worldTransform;
|
|
9662
|
+
scaleX /= scaleX / l.scaleX;
|
|
9663
|
+
scaleY /= scaleY / l.scaleY;
|
|
9481
9664
|
}
|
|
9482
|
-
renderBounds = leaf.getBounds('render',
|
|
9665
|
+
renderBounds = leaf.getBounds('render', relative);
|
|
9483
9666
|
}
|
|
9484
|
-
const { x, y, width, height } = new Bounds(renderBounds).scale(scale)
|
|
9485
|
-
let canvas = Creator.canvas({ width, height, pixelRatio });
|
|
9667
|
+
const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
|
|
9668
|
+
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
|
|
9486
9669
|
const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
|
|
9487
9670
|
if (slice) {
|
|
9488
9671
|
leaf = leafer;
|
|
@@ -9623,6 +9806,7 @@ var LeaferUI = (function (exports) {
|
|
|
9623
9806
|
exports.ResizeEvent = ResizeEvent;
|
|
9624
9807
|
exports.Run = Run;
|
|
9625
9808
|
exports.StarData = StarData;
|
|
9809
|
+
exports.State = State;
|
|
9626
9810
|
exports.StringNumberMap = StringNumberMap;
|
|
9627
9811
|
exports.TaskItem = TaskItem;
|
|
9628
9812
|
exports.TaskProcessor = TaskProcessor;
|
|
@@ -9665,6 +9849,7 @@ var LeaferUI = (function (exports) {
|
|
|
9665
9849
|
exports.opacityType = opacityType;
|
|
9666
9850
|
exports.pathInputType = pathInputType;
|
|
9667
9851
|
exports.pathType = pathType;
|
|
9852
|
+
exports.pen = pen;
|
|
9668
9853
|
exports.positionType = positionType;
|
|
9669
9854
|
exports.registerUI = registerUI;
|
|
9670
9855
|
exports.registerUIEvent = registerUIEvent;
|
|
@@ -9674,10 +9859,12 @@ var LeaferUI = (function (exports) {
|
|
|
9674
9859
|
exports.rotationType = rotationType;
|
|
9675
9860
|
exports.scaleType = scaleType;
|
|
9676
9861
|
exports.sortType = sortType;
|
|
9862
|
+
exports.stateType = stateType;
|
|
9677
9863
|
exports.strokeType = strokeType;
|
|
9678
9864
|
exports.surfaceType = surfaceType;
|
|
9679
9865
|
exports.useCanvas = useCanvas;
|
|
9680
9866
|
exports.useModule = useModule;
|
|
9867
|
+
exports.zoomLayerType = zoomLayerType;
|
|
9681
9868
|
|
|
9682
9869
|
return exports;
|
|
9683
9870
|
|