@leafer-ui/miniapp 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.
@@ -38,6 +38,18 @@ const MathHelper = {
38
38
  value = max;
39
39
  return value;
40
40
  },
41
+ minus(value, isFourNumber) {
42
+ if (value instanceof Array) {
43
+ if (isFourNumber)
44
+ value = MathHelper.fourNumber(value);
45
+ for (let i = 0; i < value.length; i++)
46
+ value[i] = -value[i];
47
+ }
48
+ else {
49
+ value = -value;
50
+ }
51
+ return value;
52
+ },
41
53
  fourNumber(num, maxValue) {
42
54
  let data;
43
55
  if (num instanceof Array) {
@@ -721,7 +733,7 @@ const { addPoint: addPoint$4 } = TwoPointBoundsHelper;
721
733
 
722
734
  const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$3, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
723
735
  const { toOuterPoint: toOuterPoint$1 } = MatrixHelper;
724
- const { float } = MathHelper;
736
+ const { float, fourNumber } = MathHelper;
725
737
  const { floor, ceil: ceil$2 } = Math;
726
738
  let right$1, bottom$1, boundsRight, boundsBottom;
727
739
  const point = {};
@@ -741,9 +753,15 @@ const BoundsHelper = {
741
753
  t.height = bounds.height;
742
754
  },
743
755
  copyAndSpread(t, bounds, spreadX, spreadY) {
744
- if (!spreadY)
745
- spreadY = spreadX;
746
- B.set(t, bounds.x - spreadX, bounds.y - spreadY, bounds.width + spreadX * 2, bounds.height + spreadY * 2);
756
+ if (spreadX instanceof Array) {
757
+ const four = fourNumber(spreadX);
758
+ B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
759
+ }
760
+ else {
761
+ if (!spreadY)
762
+ spreadY = spreadX;
763
+ B.set(t, bounds.x - spreadX, bounds.y - spreadY, bounds.width + spreadX * 2, bounds.height + spreadY * 2);
764
+ }
747
765
  },
748
766
  minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
749
767
  minY(t) { return t.height > 0 ? t.y : t.y + t.height; },
@@ -1021,8 +1039,12 @@ class Bounds {
1021
1039
  getFitMatrix(put) {
1022
1040
  return BoundsHelper.getFitMatrix(this, put);
1023
1041
  }
1024
- spread(spreadX, spreadY) {
1025
- BoundsHelper.spread(this, spreadX, spreadY);
1042
+ spread(fourNumber, spreadY) {
1043
+ BoundsHelper.spread(this, fourNumber, spreadY);
1044
+ return this;
1045
+ }
1046
+ shrink(fourNumber) {
1047
+ BoundsHelper.spread(this, MathHelper.minus(fourNumber, true));
1026
1048
  return this;
1027
1049
  }
1028
1050
  ceil() {
@@ -1447,17 +1469,30 @@ class LeafData {
1447
1469
  if (this.__input && this.__input[name] !== undefined)
1448
1470
  this.__input[name] = undefined;
1449
1471
  }
1450
- __getInputData() {
1451
- const data = { tag: this.__leaf.tag }, { __input } = this;
1452
- let value, inputValue;
1453
- for (let key in this) {
1454
- if (key[0] !== '_') {
1455
- value = this['_' + key];
1456
- if (value !== undefined) {
1457
- if (key === 'path' && !this.__pathInputed)
1458
- continue;
1459
- inputValue = __input ? __input[key] : undefined;
1460
- data[key] = (inputValue === undefined) ? value : inputValue;
1472
+ __getInputData(names) {
1473
+ const data = {};
1474
+ if (names) {
1475
+ if (names instanceof Array) {
1476
+ for (let name of names)
1477
+ data[name] = this.__getInput(name);
1478
+ }
1479
+ else {
1480
+ for (let name in names)
1481
+ data[name] = this.__getInput(name);
1482
+ }
1483
+ }
1484
+ else {
1485
+ let value, inputValue, { __input } = this;
1486
+ data.tag = this.__leaf.tag;
1487
+ for (let key in this) {
1488
+ if (key[0] !== '_') {
1489
+ value = this['_' + key];
1490
+ if (value !== undefined) {
1491
+ if (key === 'path' && !this.__pathInputed)
1492
+ continue;
1493
+ inputValue = __input ? __input[key] : undefined;
1494
+ data[key] = (inputValue === undefined) ? value : inputValue;
1495
+ }
1461
1496
  }
1462
1497
  }
1463
1498
  }
@@ -2818,12 +2853,16 @@ class PathCreator {
2818
2853
  set path(value) { this.__path = value; }
2819
2854
  get path() { return this.__path; }
2820
2855
  constructor(path) {
2856
+ this.set(path);
2857
+ }
2858
+ set(path) {
2821
2859
  if (path) {
2822
2860
  this.__path = typeof path === 'string' ? PathHelper.parse(path) : path;
2823
2861
  }
2824
2862
  else {
2825
2863
  this.__path = [];
2826
2864
  }
2865
+ return this;
2827
2866
  }
2828
2867
  beginPath() {
2829
2868
  beginPath(this.__path);
@@ -3137,6 +3176,7 @@ const PathCorner = {
3137
3176
  PathHelper.creator = new PathCreator();
3138
3177
  PathHelper.parse = PathConvert.parse;
3139
3178
  PathHelper.convertToCanvasData = PathConvert.toCanvasData;
3179
+ const pen = new PathCreator();
3140
3180
 
3141
3181
  const { drawRoundRect } = RectHelper;
3142
3182
  function roundRect(drawer) {
@@ -3421,7 +3461,7 @@ const ImageManager = {
3421
3461
  },
3422
3462
  clearRecycled() {
3423
3463
  const list = I$1.recycledList;
3424
- if (list.length) {
3464
+ if (list.length > 100) {
3425
3465
  list.forEach(image => {
3426
3466
  if (!image.use && image.url) {
3427
3467
  delete I$1.map[image.url];
@@ -3673,6 +3713,8 @@ function affectStrokeBoundsType(defaultValue) {
3673
3713
  }
3674
3714
  function doStrokeType(leaf) {
3675
3715
  leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
3716
+ if (leaf.__.__useArrow)
3717
+ doBoundsType(leaf);
3676
3718
  }
3677
3719
  const strokeType = affectStrokeBoundsType;
3678
3720
  function affectRenderBoundsType(defaultValue) {
@@ -3876,131 +3918,411 @@ function registerUIEvent() {
3876
3918
  };
3877
3919
  }
3878
3920
 
3879
- const tempMatrix = new Matrix();
3880
- const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
3881
- class LeafLayout {
3882
- get strokeBounds() { return this._strokeBounds || this.boxBounds; }
3883
- get renderBounds() { return this._renderBounds || this.boxBounds; }
3884
- get localStrokeBounds() { return this._localStrokeBounds || this; }
3885
- get localRenderBounds() { return this._localRenderBounds || this; }
3886
- get a() { return 1; }
3887
- get b() { return 0; }
3888
- get c() { return 0; }
3889
- get d() { return 1; }
3890
- get e() { return this.leaf.__.x; }
3891
- get f() { return this.leaf.__.y; }
3892
- get x() { return this.e + this.boxBounds.x; }
3893
- get y() { return this.f + this.boxBounds.y; }
3894
- get width() { return this.boxBounds.width; }
3895
- get height() { return this.boxBounds.height; }
3896
- constructor(leaf) {
3897
- this.leaf = leaf;
3898
- this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
3899
- if (this.leaf.__local)
3900
- this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
3901
- this.boxChange();
3902
- this.matrixChange();
3903
- }
3904
- createLocal() {
3905
- const local = this.leaf.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
3906
- if (!this._localStrokeBounds)
3907
- this._localStrokeBounds = local;
3908
- if (!this._localRenderBounds)
3909
- this._localRenderBounds = local;
3910
- }
3911
- update() {
3912
- const { leafer } = this.leaf;
3913
- if (leafer) {
3914
- if (leafer.ready) {
3915
- if (leafer.watcher.changed)
3916
- leafer.layouter.layout();
3921
+ const { copy: copy$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
3922
+ const matrix = {};
3923
+ const LeafHelper = {
3924
+ updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
3925
+ if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
3926
+ waitAutoLayout = true;
3927
+ updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
3928
+ if (leaf.isBranch) {
3929
+ const { children } = leaf;
3930
+ for (let i = 0, len = children.length; i < len; i++) {
3931
+ updateAllMatrix$3(children[i], checkAutoLayout, waitAutoLayout);
3917
3932
  }
3918
- else {
3919
- leafer.start();
3933
+ }
3934
+ },
3935
+ updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
3936
+ const layout = leaf.__layout;
3937
+ if (checkAutoLayout) {
3938
+ if (waitAutoLayout) {
3939
+ layout.waitAutoLayout = true;
3940
+ if (leaf.__hasAutoLayout)
3941
+ layout.matrixChanged = false;
3920
3942
  }
3921
3943
  }
3922
- else {
3923
- let root = this.leaf;
3924
- while (root.parent && !root.parent.leafer) {
3925
- root = root.parent;
3944
+ else if (layout.waitAutoLayout) {
3945
+ layout.waitAutoLayout = false;
3946
+ }
3947
+ if (layout.matrixChanged)
3948
+ leaf.__updateLocalMatrix();
3949
+ if (!layout.waitAutoLayout)
3950
+ leaf.__updateWorldMatrix();
3951
+ },
3952
+ updateBounds(leaf) {
3953
+ const layout = leaf.__layout;
3954
+ if (layout.boundsChanged)
3955
+ leaf.__updateLocalBounds();
3956
+ if (!layout.waitAutoLayout)
3957
+ leaf.__updateWorldBounds();
3958
+ },
3959
+ updateAllWorldOpacity(leaf) {
3960
+ leaf.__updateWorldOpacity();
3961
+ if (leaf.isBranch) {
3962
+ const { children } = leaf;
3963
+ for (let i = 0, len = children.length; i < len; i++) {
3964
+ updateAllWorldOpacity$1(children[i]);
3926
3965
  }
3927
- Platform.layout(root);
3928
3966
  }
3929
- }
3930
- getTransform(relative = 'world') {
3931
- this.update();
3932
- switch (relative) {
3933
- case 'world':
3934
- return this.leaf.__world;
3935
- case 'local':
3936
- return this.leaf.__localMatrix;
3937
- case 'inner':
3938
- return MatrixHelper.defaultMatrix;
3939
- default:
3940
- return new Matrix(this.leaf.__world).divideParent(relative.__world);
3967
+ },
3968
+ updateAllChange(leaf) {
3969
+ updateAllWorldOpacity$1(leaf);
3970
+ leaf.__updateChange();
3971
+ if (leaf.isBranch) {
3972
+ const { children } = leaf;
3973
+ for (let i = 0, len = children.length; i < len; i++) {
3974
+ updateAllChange$1(children[i]);
3975
+ }
3941
3976
  }
3942
- }
3943
- getBounds(type, relative = 'world') {
3944
- this.update();
3945
- switch (relative) {
3946
- case 'world':
3947
- return this.getWorldBounds(type);
3948
- case 'local':
3949
- return this.getLocalBounds(type);
3950
- case 'inner':
3951
- return this.getInnerBounds(type);
3952
- default:
3953
- return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
3977
+ },
3978
+ worldHittable(t) {
3979
+ while (t) {
3980
+ if (!t.__.hittable)
3981
+ return false;
3982
+ t = t.parent;
3954
3983
  }
3955
- }
3956
- getInnerBounds(type = 'box') {
3957
- switch (type) {
3958
- case 'render':
3959
- return this.renderBounds;
3960
- case 'content':
3961
- if (this.contentBounds)
3962
- return this.contentBounds;
3963
- case 'margin':
3964
- case 'box':
3965
- return this.boxBounds;
3966
- case 'stroke':
3967
- return this.strokeBounds;
3984
+ return true;
3985
+ },
3986
+ moveWorld(t, x, y) {
3987
+ const local = { x, y };
3988
+ if (t.parent)
3989
+ toInnerPoint$1(t.parent.worldTransform, local, local, true);
3990
+ L.moveLocal(t, local.x, local.y);
3991
+ },
3992
+ moveLocal(t, x, y = 0) {
3993
+ t.x += x;
3994
+ t.y += y;
3995
+ },
3996
+ zoomOfWorld(t, origin, scaleX, scaleY, resize) {
3997
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
3998
+ },
3999
+ zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4000
+ copy$6(matrix, t.__localMatrix);
4001
+ scaleOfOuter$3(matrix, origin, scaleX, scaleY);
4002
+ moveByMatrix(t, matrix);
4003
+ t.scaleResize(scaleX, scaleY, resize !== true);
4004
+ },
4005
+ rotateOfWorld(t, origin, angle) {
4006
+ L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4007
+ },
4008
+ rotateOfLocal(t, origin, angle) {
4009
+ copy$6(matrix, t.__localMatrix);
4010
+ rotateOfOuter$3(matrix, origin, angle);
4011
+ moveByMatrix(t, matrix);
4012
+ t.rotation = MathHelper.formatRotation(t.rotation + angle);
4013
+ },
4014
+ skewOfWorld(t, origin, skewX, skewY, resize) {
4015
+ L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4016
+ },
4017
+ skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4018
+ copy$6(matrix, t.__localMatrix);
4019
+ skewOfOuter(matrix, origin, skewX, skewY);
4020
+ L.setTransform(t, matrix, resize);
4021
+ },
4022
+ transformWorld(t, transform, resize) {
4023
+ copy$6(matrix, t.worldTransform);
4024
+ multiplyParent$2(matrix, transform);
4025
+ if (t.parent)
4026
+ divideParent(matrix, t.parent.worldTransform);
4027
+ L.setTransform(t, matrix, resize);
4028
+ },
4029
+ transform(t, transform, resize) {
4030
+ copy$6(matrix, t.localTransform);
4031
+ multiplyParent$2(matrix, transform);
4032
+ L.setTransform(t, matrix, resize);
4033
+ },
4034
+ setTransform(t, transform, resize) {
4035
+ const layout = getLayout(transform);
4036
+ if (resize) {
4037
+ t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
4038
+ delete layout.scaleX;
4039
+ delete layout.scaleY;
3968
4040
  }
3969
- }
3970
- getLocalBounds(type = 'box') {
3971
- switch (type) {
3972
- case 'render':
3973
- return this.localRenderBounds;
3974
- case 'stroke':
3975
- return this.localStrokeBounds;
3976
- case 'margin':
3977
- case 'content':
3978
- case 'box':
3979
- return this.leaf.__localBoxBounds;
4041
+ t.set(layout);
4042
+ },
4043
+ getRelativeWorld(t, relative, temp) {
4044
+ copy$6(matrix, t.worldTransform);
4045
+ divideParent(matrix, relative.worldTransform);
4046
+ return temp ? matrix : Object.assign({}, matrix);
4047
+ },
4048
+ drop(t, parent, index, resize) {
4049
+ t.setTransform(L.getRelativeWorld(t, parent, true), resize);
4050
+ parent.add(t, index);
4051
+ },
4052
+ hasParent(p, parent) {
4053
+ if (!parent)
4054
+ return false;
4055
+ while (p) {
4056
+ if (parent === p)
4057
+ return true;
4058
+ p = p.parent;
3980
4059
  }
3981
- }
3982
- getWorldBounds(type = 'box') {
3983
- switch (type) {
3984
- case 'render':
3985
- return this.leaf.__world;
3986
- case 'content':
3987
- if (this.contentBounds)
3988
- return this.getWorldContentBounds();
3989
- case 'margin':
3990
- case 'box':
3991
- return this.getWorldBoxBounds();
3992
- case 'margin':
3993
- case 'stroke':
3994
- return this.getWorldStrokeBounds();
4060
+ },
4061
+ hasParentAutoLayout(p) {
4062
+ while (p.parent) {
4063
+ p = p.parent;
4064
+ if (p.__hasAutoLayout)
4065
+ return true;
3995
4066
  }
3996
4067
  }
3997
- getLayoutBounds(type, relative = 'world', unscale) {
3998
- const { leaf } = this;
3999
- let point, matrix, bounds = this.getInnerBounds(type);
4000
- switch (relative) {
4001
- case 'world':
4002
- point = leaf.getWorldPoint(bounds);
4003
- matrix = leaf.__world;
4068
+ };
4069
+ const L = LeafHelper;
4070
+ const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4071
+ function moveByMatrix(t, matrix) {
4072
+ const { e, f } = t.__localMatrix;
4073
+ t.x += matrix.e - e;
4074
+ t.y += matrix.f - f;
4075
+ }
4076
+ function getTempLocal(t, world) {
4077
+ t.__layout.update();
4078
+ return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4079
+ }
4080
+
4081
+ const LeafBoundsHelper = {
4082
+ worldBounds(target) {
4083
+ return target.__world;
4084
+ },
4085
+ localBoxBounds(target) {
4086
+ return target.__.eraser ? null : (target.__local || target.__layout);
4087
+ },
4088
+ localStrokeBounds(target) {
4089
+ return target.__.eraser ? null : target.__layout.localStrokeBounds;
4090
+ },
4091
+ localRenderBounds(target) {
4092
+ return target.__.eraser ? null : target.__layout.localRenderBounds;
4093
+ },
4094
+ maskLocalBoxBounds(target) {
4095
+ return target.__.mask ? target.__localBoxBounds : null;
4096
+ },
4097
+ maskLocalStrokeBounds(target) {
4098
+ return target.__.mask ? target.__layout.localStrokeBounds : null;
4099
+ },
4100
+ maskLocalRenderBounds(target) {
4101
+ return target.__.mask ? target.__layout.localRenderBounds : null;
4102
+ },
4103
+ excludeRenderBounds(child, options) {
4104
+ if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
4105
+ return true;
4106
+ if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
4107
+ return true;
4108
+ return false;
4109
+ }
4110
+ };
4111
+
4112
+ const { updateBounds: updateBounds$2 } = LeafHelper;
4113
+ const BranchHelper = {
4114
+ sort(a, b) {
4115
+ return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
4116
+ },
4117
+ pushAllChildBranch(branch, leafList) {
4118
+ branch.__tempNumber = 1;
4119
+ if (branch.__.__childBranchNumber) {
4120
+ const { children } = branch;
4121
+ for (let i = 0, len = children.length; i < len; i++) {
4122
+ branch = children[i];
4123
+ if (branch.isBranch) {
4124
+ branch.__tempNumber = 1;
4125
+ leafList.add(branch);
4126
+ pushAllChildBranch$1(branch, leafList);
4127
+ }
4128
+ }
4129
+ }
4130
+ },
4131
+ pushAllParent(leaf, leafList) {
4132
+ const { keys } = leafList;
4133
+ if (keys) {
4134
+ while (leaf.parent) {
4135
+ if (keys[leaf.parent.innerId] === undefined) {
4136
+ leafList.add(leaf.parent);
4137
+ leaf = leaf.parent;
4138
+ }
4139
+ else {
4140
+ break;
4141
+ }
4142
+ }
4143
+ }
4144
+ else {
4145
+ while (leaf.parent) {
4146
+ leafList.add(leaf.parent);
4147
+ leaf = leaf.parent;
4148
+ }
4149
+ }
4150
+ },
4151
+ pushAllBranchStack(branch, pushList) {
4152
+ let start = pushList.length;
4153
+ const { children } = branch;
4154
+ for (let i = 0, len = children.length; i < len; i++) {
4155
+ if (children[i].isBranch) {
4156
+ pushList.push(children[i]);
4157
+ }
4158
+ }
4159
+ for (let i = start, len = pushList.length; i < len; i++) {
4160
+ pushAllBranchStack(pushList[i], pushList);
4161
+ }
4162
+ },
4163
+ updateBounds(branch, exclude) {
4164
+ const branchStack = [branch];
4165
+ pushAllBranchStack(branch, branchStack);
4166
+ updateBoundsByBranchStack(branchStack, exclude);
4167
+ },
4168
+ updateBoundsByBranchStack(branchStack, exclude) {
4169
+ let branch, children;
4170
+ for (let i = branchStack.length - 1; i > -1; i--) {
4171
+ branch = branchStack[i];
4172
+ children = branch.children;
4173
+ for (let j = 0, len = children.length; j < len; j++) {
4174
+ updateBounds$2(children[j]);
4175
+ }
4176
+ if (exclude && exclude === branch)
4177
+ continue;
4178
+ updateBounds$2(branch);
4179
+ }
4180
+ }
4181
+ };
4182
+ const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
4183
+
4184
+ const WaitHelper = {
4185
+ run(wait) {
4186
+ if (wait.length) {
4187
+ const len = wait.length;
4188
+ for (let i = 0; i < len; i++) {
4189
+ wait[i]();
4190
+ }
4191
+ wait.length === len ? wait.length = 0 : wait.splice(0, len);
4192
+ }
4193
+ }
4194
+ };
4195
+
4196
+ const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
4197
+ const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
4198
+ class LeafLayout {
4199
+ get strokeBounds() { return this._strokeBounds || this.boxBounds; }
4200
+ get renderBounds() { return this._renderBounds || this.boxBounds; }
4201
+ get localStrokeBounds() { return this._localStrokeBounds || this; }
4202
+ get localRenderBounds() { return this._localRenderBounds || this; }
4203
+ get a() { return 1; }
4204
+ get b() { return 0; }
4205
+ get c() { return 0; }
4206
+ get d() { return 1; }
4207
+ get e() { return this.leaf.__.x; }
4208
+ get f() { return this.leaf.__.y; }
4209
+ get x() { return this.e + this.boxBounds.x; }
4210
+ get y() { return this.f + this.boxBounds.y; }
4211
+ get width() { return this.boxBounds.width; }
4212
+ get height() { return this.boxBounds.height; }
4213
+ constructor(leaf) {
4214
+ this.leaf = leaf;
4215
+ this.boxBounds = { x: 0, y: 0, width: 0, height: 0 };
4216
+ if (this.leaf.__local)
4217
+ this._localRenderBounds = this._localStrokeBounds = this.leaf.__local;
4218
+ this.boxChange();
4219
+ this.matrixChange();
4220
+ }
4221
+ createLocal() {
4222
+ const local = this.leaf.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 };
4223
+ if (!this._localStrokeBounds)
4224
+ this._localStrokeBounds = local;
4225
+ if (!this._localRenderBounds)
4226
+ this._localRenderBounds = local;
4227
+ }
4228
+ update() {
4229
+ const { leafer } = this.leaf;
4230
+ if (leafer) {
4231
+ if (leafer.ready) {
4232
+ if (leafer.watcher.changed)
4233
+ leafer.layouter.layout();
4234
+ }
4235
+ else {
4236
+ leafer.start();
4237
+ }
4238
+ }
4239
+ else {
4240
+ let root = this.leaf;
4241
+ while (root.parent && !root.parent.leafer) {
4242
+ root = root.parent;
4243
+ }
4244
+ Platform.layout(root);
4245
+ }
4246
+ }
4247
+ getTransform(relative = 'world') {
4248
+ this.update();
4249
+ const { leaf } = this;
4250
+ switch (relative) {
4251
+ case 'world':
4252
+ return leaf.__world;
4253
+ case 'local':
4254
+ return leaf.__localMatrix;
4255
+ case 'inner':
4256
+ return MatrixHelper.defaultMatrix;
4257
+ case 'page':
4258
+ relative = leaf.zoomLayer;
4259
+ default:
4260
+ return getRelativeWorld$1(leaf, relative);
4261
+ }
4262
+ }
4263
+ getBounds(type, relative = 'world') {
4264
+ this.update();
4265
+ switch (relative) {
4266
+ case 'world':
4267
+ return this.getWorldBounds(type);
4268
+ case 'local':
4269
+ return this.getLocalBounds(type);
4270
+ case 'inner':
4271
+ return this.getInnerBounds(type);
4272
+ case 'page':
4273
+ relative = this.leaf.zoomLayer;
4274
+ default:
4275
+ return new Bounds(this.getInnerBounds(type)).toOuterOf(this.getTransform(relative));
4276
+ }
4277
+ }
4278
+ getInnerBounds(type = 'box') {
4279
+ switch (type) {
4280
+ case 'render':
4281
+ return this.renderBounds;
4282
+ case 'content':
4283
+ if (this.contentBounds)
4284
+ return this.contentBounds;
4285
+ case 'margin':
4286
+ case 'box':
4287
+ return this.boxBounds;
4288
+ case 'stroke':
4289
+ return this.strokeBounds;
4290
+ }
4291
+ }
4292
+ getLocalBounds(type = 'box') {
4293
+ switch (type) {
4294
+ case 'render':
4295
+ return this.localRenderBounds;
4296
+ case 'stroke':
4297
+ return this.localStrokeBounds;
4298
+ case 'margin':
4299
+ case 'content':
4300
+ case 'box':
4301
+ return this.leaf.__localBoxBounds;
4302
+ }
4303
+ }
4304
+ getWorldBounds(type = 'box') {
4305
+ switch (type) {
4306
+ case 'render':
4307
+ return this.leaf.__world;
4308
+ case 'content':
4309
+ if (this.contentBounds)
4310
+ return this.getWorldContentBounds();
4311
+ case 'margin':
4312
+ case 'box':
4313
+ return this.getWorldBoxBounds();
4314
+ case 'margin':
4315
+ case 'stroke':
4316
+ return this.getWorldStrokeBounds();
4317
+ }
4318
+ }
4319
+ getLayoutBounds(type, relative = 'world', unscale) {
4320
+ const { leaf } = this;
4321
+ let point, matrix, bounds = this.getInnerBounds(type);
4322
+ switch (relative) {
4323
+ case 'world':
4324
+ point = leaf.getWorldPoint(bounds);
4325
+ matrix = leaf.__world;
4004
4326
  break;
4005
4327
  case 'local':
4006
4328
  point = leaf.getLocalPointByInner(bounds);
@@ -4010,12 +4332,14 @@ class LeafLayout {
4010
4332
  point = bounds;
4011
4333
  matrix = MatrixHelper.defaultMatrix;
4012
4334
  break;
4335
+ case 'page':
4336
+ relative = leaf.zoomLayer;
4013
4337
  default:
4014
4338
  point = leaf.getWorldPoint(bounds, relative);
4015
- matrix = tempMatrix.set(leaf.__world).divideParent(relative.__world);
4339
+ matrix = getRelativeWorld$1(leaf, relative, true);
4016
4340
  }
4017
4341
  const layoutBounds = MatrixHelper.getLayout(matrix);
4018
- copy$6(layoutBounds, bounds);
4342
+ copy$5(layoutBounds, bounds);
4019
4343
  PointHelper.copy(layoutBounds, point);
4020
4344
  if (unscale) {
4021
4345
  const { scaleX, scaleY } = layoutBounds;
@@ -4043,6 +4367,8 @@ class LeafLayout {
4043
4367
  break;
4044
4368
  case 'inner':
4045
4369
  break;
4370
+ case 'page':
4371
+ relative = leaf.zoomLayer;
4046
4372
  default:
4047
4373
  relativeLeaf = relative;
4048
4374
  }
@@ -4381,360 +4707,88 @@ class RenderEvent extends Event {
4381
4707
  if (times)
4382
4708
  this.times = times;
4383
4709
  if (bounds) {
4384
- this.renderBounds = bounds;
4385
- this.renderOptions = options;
4386
- }
4387
- }
4388
- }
4389
- RenderEvent.REQUEST = 'render.request';
4390
- RenderEvent.START = 'render.start';
4391
- RenderEvent.BEFORE = 'render.before';
4392
- RenderEvent.RENDER = 'render';
4393
- RenderEvent.AFTER = 'render.after';
4394
- RenderEvent.AGAIN = 'render.again';
4395
- RenderEvent.END = 'render.end';
4396
- RenderEvent.NEXT = 'render.next';
4397
-
4398
- class LeaferEvent extends Event {
4399
- }
4400
- LeaferEvent.START = 'leafer.start';
4401
- LeaferEvent.BEFORE_READY = 'leafer.before_ready';
4402
- LeaferEvent.READY = 'leafer.ready';
4403
- LeaferEvent.AFTER_READY = 'leafer.after_ready';
4404
- LeaferEvent.VIEW_READY = 'leafer.view_ready';
4405
- LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
4406
- LeaferEvent.STOP = 'leafer.stop';
4407
- LeaferEvent.RESTART = 'leafer.restart';
4408
- LeaferEvent.END = 'leafer.end';
4409
-
4410
- const LeafDataProxy = {
4411
- __setAttr(name, newValue) {
4412
- if (this.leafer && this.leafer.created) {
4413
- const oldValue = this.__.__getInput(name);
4414
- if (typeof newValue === 'object' || oldValue !== newValue) {
4415
- this.__[name] = newValue;
4416
- if (this.__proxyData)
4417
- this.setProxyAttr(name, newValue);
4418
- const { CHANGE } = PropertyEvent;
4419
- const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
4420
- if (this.isLeafer) {
4421
- this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
4422
- }
4423
- else {
4424
- if (this.hasEvent(CHANGE))
4425
- this.emitEvent(event);
4426
- }
4427
- this.leafer.emitEvent(event);
4428
- }
4429
- }
4430
- else {
4431
- this.__[name] = newValue;
4432
- if (this.__proxyData)
4433
- this.setProxyAttr(name, newValue);
4434
- }
4435
- },
4436
- __getAttr(name) {
4437
- if (this.__proxyData)
4438
- return this.getProxyAttr(name);
4439
- return this.__.__get(name);
4440
- }
4441
- };
4442
-
4443
- const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
4444
- const { toPoint, tempPoint } = AroundHelper;
4445
- const LeafMatrix = {
4446
- __updateWorldMatrix() {
4447
- multiplyParent$2(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
4448
- },
4449
- __updateLocalMatrix() {
4450
- if (this.__local) {
4451
- const layout = this.__layout, local = this.__local, data = this.__;
4452
- if (layout.affectScaleOrRotation) {
4453
- if (layout.scaleChanged || layout.rotationChanged) {
4454
- setLayout(local, data, null, layout.affectRotation);
4455
- layout.scaleChanged = layout.rotationChanged = false;
4456
- }
4457
- }
4458
- local.e = data.x;
4459
- local.f = data.y;
4460
- if (data.around) {
4461
- toPoint(data.around, layout.boxBounds, tempPoint);
4462
- translateInner(local, -tempPoint.x, -tempPoint.y);
4463
- }
4464
- }
4465
- this.__layout.matrixChanged = false;
4466
- }
4467
- };
4468
-
4469
- const { copy: copy$5, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$1, divideParent, getLayout } = MatrixHelper;
4470
- const matrix = {};
4471
- const LeafHelper = {
4472
- updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
4473
- if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
4474
- waitAutoLayout = true;
4475
- updateMatrix$2(leaf, checkAutoLayout, waitAutoLayout);
4476
- if (leaf.isBranch) {
4477
- const { children } = leaf;
4478
- for (let i = 0, len = children.length; i < len; i++) {
4479
- updateAllMatrix$3(children[i], checkAutoLayout, waitAutoLayout);
4480
- }
4481
- }
4482
- },
4483
- updateMatrix(leaf, checkAutoLayout, waitAutoLayout) {
4484
- const layout = leaf.__layout;
4485
- if (checkAutoLayout) {
4486
- if (waitAutoLayout) {
4487
- layout.waitAutoLayout = true;
4488
- if (leaf.__hasAutoLayout)
4489
- layout.matrixChanged = false;
4490
- }
4491
- }
4492
- else if (layout.waitAutoLayout) {
4493
- layout.waitAutoLayout = false;
4494
- }
4495
- if (layout.matrixChanged)
4496
- leaf.__updateLocalMatrix();
4497
- if (!layout.waitAutoLayout)
4498
- leaf.__updateWorldMatrix();
4499
- },
4500
- updateBounds(leaf) {
4501
- const layout = leaf.__layout;
4502
- if (layout.boundsChanged)
4503
- leaf.__updateLocalBounds();
4504
- if (!layout.waitAutoLayout)
4505
- leaf.__updateWorldBounds();
4506
- },
4507
- updateAllWorldOpacity(leaf) {
4508
- leaf.__updateWorldOpacity();
4509
- if (leaf.isBranch) {
4510
- const { children } = leaf;
4511
- for (let i = 0, len = children.length; i < len; i++) {
4512
- updateAllWorldOpacity$1(children[i]);
4513
- }
4514
- }
4515
- },
4516
- updateAllChange(leaf) {
4517
- updateAllWorldOpacity$1(leaf);
4518
- leaf.__updateChange();
4519
- if (leaf.isBranch) {
4520
- const { children } = leaf;
4521
- for (let i = 0, len = children.length; i < len; i++) {
4522
- updateAllChange$1(children[i]);
4523
- }
4524
- }
4525
- },
4526
- worldHittable(t) {
4527
- while (t) {
4528
- if (!t.__.hittable)
4529
- return false;
4530
- t = t.parent;
4531
- }
4532
- return true;
4533
- },
4534
- moveWorld(t, x, y) {
4535
- const local = { x, y };
4536
- if (t.parent)
4537
- toInnerPoint$1(t.parent.worldTransform, local, local, true);
4538
- L.moveLocal(t, local.x, local.y);
4539
- },
4540
- moveLocal(t, x, y = 0) {
4541
- t.x += x;
4542
- t.y += y;
4543
- },
4544
- zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4545
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
4546
- },
4547
- zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4548
- copy$5(matrix, t.__localMatrix);
4549
- scaleOfOuter$3(matrix, origin, scaleX, scaleY);
4550
- moveByMatrix(t, matrix);
4551
- t.scaleResize(scaleX, scaleY, resize !== true);
4552
- },
4553
- rotateOfWorld(t, origin, angle) {
4554
- L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4555
- },
4556
- rotateOfLocal(t, origin, angle) {
4557
- copy$5(matrix, t.__localMatrix);
4558
- rotateOfOuter$3(matrix, origin, angle);
4559
- moveByMatrix(t, matrix);
4560
- t.rotation = MathHelper.formatRotation(t.rotation + angle);
4561
- },
4562
- skewOfWorld(t, origin, skewX, skewY, resize) {
4563
- L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4564
- },
4565
- skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4566
- copy$5(matrix, t.__localMatrix);
4567
- skewOfOuter(matrix, origin, skewX, skewY);
4568
- L.setTransform(t, matrix, resize);
4569
- },
4570
- transformWorld(t, transform, resize) {
4571
- copy$5(matrix, t.worldTransform);
4572
- multiplyParent$1(matrix, transform);
4573
- if (t.parent)
4574
- divideParent(matrix, t.parent.worldTransform);
4575
- L.setTransform(t, matrix, resize);
4576
- },
4577
- transform(t, transform, resize) {
4578
- copy$5(matrix, t.localTransform);
4579
- multiplyParent$1(matrix, transform);
4580
- L.setTransform(t, matrix, resize);
4581
- },
4582
- setTransform(t, transform, resize) {
4583
- const layout = getLayout(transform);
4584
- if (resize) {
4585
- t.scaleResize(layout.scaleX / t.scaleX, layout.scaleY / t.scaleY, resize !== true);
4586
- delete layout.scaleX;
4587
- delete layout.scaleY;
4588
- }
4589
- t.set(layout);
4590
- },
4591
- drop(t, parent, index, resize) {
4592
- copy$5(matrix, t.worldTransform);
4593
- divideParent(matrix, parent.worldTransform);
4594
- t.setTransform(matrix, resize);
4595
- parent.add(t, index);
4596
- },
4597
- hasParent(p, parent) {
4598
- if (!parent)
4599
- return false;
4600
- while (p) {
4601
- if (parent === p)
4602
- return true;
4603
- p = p.parent;
4604
- }
4605
- },
4606
- hasParentAutoLayout(p) {
4607
- while (p.parent) {
4608
- p = p.parent;
4609
- if (p.__hasAutoLayout)
4610
- return true;
4611
- }
4612
- }
4613
- };
4614
- const L = LeafHelper;
4615
- const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4616
- function moveByMatrix(t, matrix) {
4617
- const { e, f } = t.__localMatrix;
4618
- t.x += matrix.e - e;
4619
- t.y += matrix.f - f;
4620
- }
4621
- function getTempLocal(t, world) {
4622
- t.__layout.update();
4623
- return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
4624
- }
4625
-
4626
- const LeafBoundsHelper = {
4627
- worldBounds(target) {
4628
- return target.__world;
4629
- },
4630
- localBoxBounds(target) {
4631
- return target.__.eraser ? null : (target.__local || target.__layout);
4632
- },
4633
- localStrokeBounds(target) {
4634
- return target.__.eraser ? null : target.__layout.localStrokeBounds;
4635
- },
4636
- localRenderBounds(target) {
4637
- return target.__.eraser ? null : target.__layout.localRenderBounds;
4638
- },
4639
- maskLocalBoxBounds(target) {
4640
- return target.__.mask ? target.__localBoxBounds : null;
4641
- },
4642
- maskLocalStrokeBounds(target) {
4643
- return target.__.mask ? target.__layout.localStrokeBounds : null;
4644
- },
4645
- maskLocalRenderBounds(target) {
4646
- return target.__.mask ? target.__layout.localRenderBounds : null;
4647
- },
4648
- excludeRenderBounds(child, options) {
4649
- if (options.bounds && !options.bounds.hit(child.__world, options.matrix))
4650
- return true;
4651
- if (options.hideBounds && options.hideBounds.includes(child.__world, options.matrix))
4652
- return true;
4653
- return false;
4710
+ this.renderBounds = bounds;
4711
+ this.renderOptions = options;
4712
+ }
4654
4713
  }
4655
- };
4714
+ }
4715
+ RenderEvent.REQUEST = 'render.request';
4716
+ RenderEvent.START = 'render.start';
4717
+ RenderEvent.BEFORE = 'render.before';
4718
+ RenderEvent.RENDER = 'render';
4719
+ RenderEvent.AFTER = 'render.after';
4720
+ RenderEvent.AGAIN = 'render.again';
4721
+ RenderEvent.END = 'render.end';
4722
+ RenderEvent.NEXT = 'render.next';
4656
4723
 
4657
- const { updateBounds: updateBounds$2 } = LeafHelper;
4658
- const BranchHelper = {
4659
- sort(a, b) {
4660
- return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
4661
- },
4662
- pushAllChildBranch(branch, leafList) {
4663
- branch.__tempNumber = 1;
4664
- if (branch.__.__childBranchNumber) {
4665
- const { children } = branch;
4666
- for (let i = 0, len = children.length; i < len; i++) {
4667
- branch = children[i];
4668
- if (branch.isBranch) {
4669
- branch.__tempNumber = 1;
4670
- leafList.add(branch);
4671
- pushAllChildBranch$1(branch, leafList);
4672
- }
4673
- }
4674
- }
4675
- },
4676
- pushAllParent(leaf, leafList) {
4677
- const { keys } = leafList;
4678
- if (keys) {
4679
- while (leaf.parent) {
4680
- if (keys[leaf.parent.innerId] === undefined) {
4681
- leafList.add(leaf.parent);
4682
- leaf = leaf.parent;
4724
+ class LeaferEvent extends Event {
4725
+ }
4726
+ LeaferEvent.START = 'leafer.start';
4727
+ LeaferEvent.BEFORE_READY = 'leafer.before_ready';
4728
+ LeaferEvent.READY = 'leafer.ready';
4729
+ LeaferEvent.AFTER_READY = 'leafer.after_ready';
4730
+ LeaferEvent.VIEW_READY = 'leafer.view_ready';
4731
+ LeaferEvent.VIEW_COMPLETED = 'leafer.view_completed';
4732
+ LeaferEvent.STOP = 'leafer.stop';
4733
+ LeaferEvent.RESTART = 'leafer.restart';
4734
+ LeaferEvent.END = 'leafer.end';
4735
+
4736
+ const LeafDataProxy = {
4737
+ __setAttr(name, newValue) {
4738
+ if (this.leafer && this.leafer.created) {
4739
+ const oldValue = this.__.__getInput(name);
4740
+ if (typeof newValue === 'object' || oldValue !== newValue) {
4741
+ this.__[name] = newValue;
4742
+ if (this.__proxyData)
4743
+ this.setProxyAttr(name, newValue);
4744
+ const { CHANGE } = PropertyEvent;
4745
+ const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue);
4746
+ if (this.isLeafer) {
4747
+ this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue));
4683
4748
  }
4684
4749
  else {
4685
- break;
4750
+ if (this.hasEvent(CHANGE))
4751
+ this.emitEvent(event);
4686
4752
  }
4753
+ this.leafer.emitEvent(event);
4687
4754
  }
4688
4755
  }
4689
4756
  else {
4690
- while (leaf.parent) {
4691
- leafList.add(leaf.parent);
4692
- leaf = leaf.parent;
4693
- }
4694
- }
4695
- },
4696
- pushAllBranchStack(branch, pushList) {
4697
- let start = pushList.length;
4698
- const { children } = branch;
4699
- for (let i = 0, len = children.length; i < len; i++) {
4700
- if (children[i].isBranch) {
4701
- pushList.push(children[i]);
4702
- }
4703
- }
4704
- for (let i = start, len = pushList.length; i < len; i++) {
4705
- pushAllBranchStack(pushList[i], pushList);
4757
+ this.__[name] = newValue;
4758
+ if (this.__proxyData)
4759
+ this.setProxyAttr(name, newValue);
4706
4760
  }
4707
4761
  },
4708
- updateBounds(branch, exclude) {
4709
- const branchStack = [branch];
4710
- pushAllBranchStack(branch, branchStack);
4711
- updateBoundsByBranchStack(branchStack, exclude);
4712
- },
4713
- updateBoundsByBranchStack(branchStack, exclude) {
4714
- let branch, children;
4715
- for (let i = branchStack.length - 1; i > -1; i--) {
4716
- branch = branchStack[i];
4717
- children = branch.children;
4718
- for (let j = 0, len = children.length; j < len; j++) {
4719
- updateBounds$2(children[j]);
4720
- }
4721
- if (exclude && exclude === branch)
4722
- continue;
4723
- updateBounds$2(branch);
4724
- }
4762
+ __getAttr(name) {
4763
+ if (this.__proxyData)
4764
+ return this.getProxyAttr(name);
4765
+ return this.__.__get(name);
4725
4766
  }
4726
4767
  };
4727
- const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoundsByBranchStack } = BranchHelper;
4728
4768
 
4729
- const WaitHelper = {
4730
- run(wait) {
4731
- if (wait.length) {
4732
- const len = wait.length;
4733
- for (let i = 0; i < len; i++) {
4734
- wait[i]();
4769
+ const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
4770
+ const { toPoint, tempPoint } = AroundHelper;
4771
+ const LeafMatrix = {
4772
+ __updateWorldMatrix() {
4773
+ multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
4774
+ },
4775
+ __updateLocalMatrix() {
4776
+ if (this.__local) {
4777
+ const layout = this.__layout, local = this.__local, data = this.__;
4778
+ if (layout.affectScaleOrRotation) {
4779
+ if (layout.scaleChanged || layout.rotationChanged) {
4780
+ setLayout(local, data, null, layout.affectRotation);
4781
+ layout.scaleChanged = layout.rotationChanged = false;
4782
+ }
4783
+ }
4784
+ local.e = data.x;
4785
+ local.f = data.y;
4786
+ if (data.around) {
4787
+ toPoint(data.around, layout.boxBounds, tempPoint);
4788
+ translateInner(local, -tempPoint.x, -tempPoint.y);
4735
4789
  }
4736
- wait.length === len ? wait.length = 0 : wait.splice(0, len);
4737
4790
  }
4791
+ this.__layout.matrixChanged = false;
4738
4792
  }
4739
4793
  };
4740
4794
 
@@ -4951,7 +5005,7 @@ const { LEAF, create } = IncrementId;
4951
5005
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
4952
5006
  const { toOuterOf } = BoundsHelper;
4953
5007
  const { tempToOuterOf, copy: copy$4 } = PointHelper;
4954
- const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, transform, setTransform, drop } = LeafHelper;
5008
+ const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getRelativeWorld, drop } = LeafHelper;
4955
5009
  let Leaf = class Leaf {
4956
5010
  get tag() { return this.__tag; }
4957
5011
  set tag(_value) { }
@@ -4989,21 +5043,31 @@ let Leaf = class Leaf {
4989
5043
  this.__layout = new this.__LayoutProcessor(this);
4990
5044
  if (this.__level)
4991
5045
  this.resetCustom();
4992
- if (data)
5046
+ if (data) {
5047
+ if (data.__)
5048
+ data = data.toJSON();
4993
5049
  data.children ? this.set(data) : Object.assign(this, data);
5050
+ }
4994
5051
  }
4995
5052
  resetCustom() {
4996
5053
  this.__hasMask = this.__hasEraser = null;
4997
5054
  this.forceUpdate();
4998
5055
  }
4999
- waitParent(item) {
5056
+ waitParent(item, bind) {
5057
+ if (bind)
5058
+ item = item.bind(bind);
5000
5059
  this.parent ? item() : (this.__parentWait ? this.__parentWait.push(item) : this.__parentWait = [item]);
5001
5060
  }
5002
- waitLeafer(item) {
5061
+ waitLeafer(item, bind) {
5062
+ if (bind)
5063
+ item = item.bind(bind);
5003
5064
  this.leafer ? item() : (this.__leaferWait ? this.__leaferWait.push(item) : this.__leaferWait = [item]);
5004
5065
  }
5005
- nextRender(item, off) {
5006
- this.leafer ? this.leafer.nextRender(item, off) : this.waitLeafer(() => this.leafer.nextRender(item, off));
5066
+ nextRender(item, bind, off) {
5067
+ this.leafer ? this.leafer.nextRender(item, bind, off) : this.waitLeafer(() => this.leafer.nextRender(item, bind, off));
5068
+ }
5069
+ removeNextRender(item) {
5070
+ this.nextRender(item, null, 'off');
5007
5071
  }
5008
5072
  __bindLeafer(leafer) {
5009
5073
  if (this.isLeafer) {
@@ -5040,6 +5104,7 @@ let Leaf = class Leaf {
5040
5104
  getProxyAttr(_attrName) { return undefined; }
5041
5105
  find(_condition, _options) { return undefined; }
5042
5106
  findOne(_condition, _options) { return undefined; }
5107
+ focus(_value) { }
5043
5108
  forceUpdate(attrName) {
5044
5109
  if (attrName === undefined)
5045
5110
  attrName = 'width';
@@ -5095,6 +5160,9 @@ let Leaf = class Leaf {
5095
5160
  return this.__world.f;
5096
5161
  return this.getLayoutBounds()[attrName];
5097
5162
  }
5163
+ getTransform(relative) {
5164
+ return this.__layout.getTransform(relative || 'local');
5165
+ }
5098
5166
  getBounds(type, relative) {
5099
5167
  return this.__layout.getBounds(type, relative);
5100
5168
  }
@@ -5104,6 +5172,12 @@ let Leaf = class Leaf {
5104
5172
  getLayoutPoints(type, relative) {
5105
5173
  return this.__layout.getLayoutPoints(type, relative);
5106
5174
  }
5175
+ getWorldBounds(inner, relative, change) {
5176
+ const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
5177
+ const to = change ? inner : {};
5178
+ toOuterOf(inner, matrix, to);
5179
+ return to;
5180
+ }
5107
5181
  worldToLocal(world, to, distance, relative) {
5108
5182
  if (this.parent) {
5109
5183
  this.parent.worldToInner(world, to, distance, relative);
@@ -5186,6 +5260,21 @@ let Leaf = class Leaf {
5186
5260
  skewOf(origin, skewX, skewY, resize) {
5187
5261
  skewOfLocal(this, tempToOuterOf(origin, this.localTransform), skewX, skewY, resize);
5188
5262
  }
5263
+ transformWorld(worldTransform, resize) {
5264
+ transformWorld(this, worldTransform, resize);
5265
+ }
5266
+ moveWorld(x, y) {
5267
+ moveWorld(this, x, y);
5268
+ }
5269
+ scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5270
+ zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
5271
+ }
5272
+ rotateOfWorld(worldOrigin, rotation) {
5273
+ rotateOfWorld(this, worldOrigin, rotation);
5274
+ }
5275
+ skewOfWorld(worldOrigin, skewX, skewY, resize) {
5276
+ skewOfWorld(this, worldOrigin, skewX, skewY, resize);
5277
+ }
5189
5278
  scaleResize(scaleX, scaleY = scaleX, _noResize) {
5190
5279
  this.scaleX *= scaleX;
5191
5280
  this.scaleY *= scaleY;
@@ -5317,7 +5406,8 @@ let Branch = class Branch extends Leaf {
5317
5406
  index === undefined ? this.children.push(child) : this.children.splice(index, 0, child);
5318
5407
  if (child.isBranch)
5319
5408
  this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
5320
- child.__layout.boundsChanged || child.__layout.matrixChange();
5409
+ child.__layout.boxChanged || child.__layout.boxChange();
5410
+ child.__layout.matrixChanged || child.__layout.matrixChange();
5321
5411
  if (child.__parentWait)
5322
5412
  WaitHelper.run(child.__parentWait);
5323
5413
  if (this.leafer) {
@@ -6165,6 +6255,10 @@ class Renderer {
6165
6255
  }
6166
6256
  else {
6167
6257
  this.requestLayout();
6258
+ if (this.ignore) {
6259
+ this.ignore = this.rendering = false;
6260
+ return;
6261
+ }
6168
6262
  this.emitRender(RenderEvent.BEFORE);
6169
6263
  if (this.config.usePartRender && this.totalTimes > 1) {
6170
6264
  this.partRender();
@@ -6312,9 +6406,7 @@ class Renderer {
6312
6406
  if (this.target) {
6313
6407
  this.stop();
6314
6408
  this.__removeListenEvents();
6315
- this.target = null;
6316
- this.canvas = null;
6317
- this.config = null;
6409
+ this.target = this.canvas = this.config = null;
6318
6410
  }
6319
6411
  }
6320
6412
  }
@@ -6571,14 +6663,36 @@ Object.assign(Creator, {
6571
6663
  });
6572
6664
  Platform.layout = Layouter.fullLayout;
6573
6665
 
6666
+ const TextConvert = {};
6667
+ const ColorConvert = {};
6668
+ const PathArrow = {};
6669
+ const Paint = {};
6670
+ const PaintImage = {};
6671
+ const PaintGradient = {};
6672
+ const Effect = {};
6673
+ const Export = {};
6674
+ const State = {};
6675
+
6676
+ function stateType(defaultValue) {
6677
+ return (target, key) => {
6678
+ const stateType = key + 'Style';
6679
+ defineLeafAttr(target, key, defaultValue, {
6680
+ set(value) {
6681
+ this.__setAttr(key, value);
6682
+ this.waitLeafer(() => { if (State.setStyle)
6683
+ State.setStyle(this, stateType, value); });
6684
+ }
6685
+ });
6686
+ };
6687
+ }
6574
6688
  function arrowType(defaultValue) {
6575
6689
  return (target, key) => {
6576
6690
  defineLeafAttr(target, key, defaultValue, {
6577
6691
  set(value) {
6578
6692
  this.__setAttr(key, value);
6579
- doStrokeType(this);
6580
6693
  const data = this.__;
6581
6694
  data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6695
+ doStrokeType(this);
6582
6696
  }
6583
6697
  });
6584
6698
  };
@@ -6606,15 +6720,16 @@ function resizeType(defaultValue) {
6606
6720
  });
6607
6721
  };
6608
6722
  }
6609
-
6610
- const TextConvert = {};
6611
- const ColorConvert = {};
6612
- const PathArrow = {};
6613
- const Paint = {};
6614
- const PaintImage = {};
6615
- const PaintGradient = {};
6616
- const Effect = {};
6617
- const Export = {};
6723
+ function zoomLayerType() {
6724
+ return (target, key) => {
6725
+ const privateKey = '_' + key;
6726
+ defineKey(target, key, {
6727
+ set(value) { if (this.isLeafer)
6728
+ this[privateKey] = value; },
6729
+ get() { return this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer; }
6730
+ });
6731
+ };
6732
+ }
6618
6733
 
6619
6734
  const { parse } = PathConvert;
6620
6735
  const emptyPaint = {};
@@ -6623,7 +6738,7 @@ class UIData extends LeafData {
6623
6738
  get __strokeWidth() {
6624
6739
  const { strokeWidth, strokeWidthFixed } = this;
6625
6740
  if (strokeWidthFixed) {
6626
- let { scaleX } = this.__leaf.__world;
6741
+ let { scaleX } = this.__leaf.__nowWorld;
6627
6742
  if (scaleX < 0)
6628
6743
  scaleX = -scaleX;
6629
6744
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
@@ -6897,18 +7012,11 @@ const UIRender = {
6897
7012
  }
6898
7013
  },
6899
7014
  __drawFast(canvas, options) {
6900
- const { fill, stroke, __drawAfterFill } = this.__;
6901
- this.__drawRenderPath(canvas);
6902
- if (fill)
6903
- Paint.fill(fill, this, canvas);
6904
- if (__drawAfterFill)
6905
- this.__drawAfterFill(canvas, options);
6906
- if (stroke)
6907
- Paint.stroke(stroke, this, canvas);
7015
+ drawFast(this, canvas, options);
6908
7016
  },
6909
7017
  __draw(canvas, options) {
6910
- if (this.__.__complex) {
6911
- const data = this.__;
7018
+ const data = this.__;
7019
+ if (data.__complex) {
6912
7020
  if (data.__needComputePaint)
6913
7021
  data.__computePaint();
6914
7022
  const { fill, stroke, __drawAfterFill } = data;
@@ -6941,7 +7049,12 @@ const UIRender = {
6941
7049
  }
6942
7050
  }
6943
7051
  else {
6944
- this.__drawFast(canvas, options);
7052
+ if (data.__pathInputed) {
7053
+ drawFast(this, canvas, options);
7054
+ }
7055
+ else {
7056
+ this.__drawFast(canvas, options);
7057
+ }
6945
7058
  }
6946
7059
  },
6947
7060
  __renderShape(canvas, options) {
@@ -6956,6 +7069,16 @@ const UIRender = {
6956
7069
  }
6957
7070
  }
6958
7071
  };
7072
+ function drawFast(ui, canvas, options) {
7073
+ const { fill, stroke, __drawAfterFill } = ui.__;
7074
+ ui.__drawRenderPath(canvas);
7075
+ if (fill)
7076
+ Paint.fill(fill, ui, canvas);
7077
+ if (__drawAfterFill)
7078
+ ui.__drawAfterFill(canvas, options);
7079
+ if (stroke)
7080
+ Paint.stroke(stroke, ui, canvas);
7081
+ }
6959
7082
 
6960
7083
  const RectRender = {
6961
7084
  __drawFast(canvas, options) {
@@ -7004,6 +7127,10 @@ let UI = UI_1 = class UI extends Leaf {
7004
7127
  const { scaleX, scaleY } = this;
7005
7128
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
7006
7129
  }
7130
+ get pen() {
7131
+ pen.set(this.path = this.__.path || []);
7132
+ return pen;
7133
+ }
7007
7134
  constructor(data) {
7008
7135
  super(data);
7009
7136
  }
@@ -7012,7 +7139,7 @@ let UI = UI_1 = class UI extends Leaf {
7012
7139
  Object.assign(this, data);
7013
7140
  }
7014
7141
  get(name) {
7015
- return name ? this.__.__getInput(name) : this.__.__getInputData();
7142
+ return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
7016
7143
  }
7017
7144
  createProxyData() { return undefined; }
7018
7145
  find(_condition, _options) { return undefined; }
@@ -7021,10 +7148,11 @@ let UI = UI_1 = class UI extends Leaf {
7021
7148
  this.__layout.update();
7022
7149
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
7023
7150
  if (!path) {
7024
- path = [];
7025
7151
  const { width, height } = this.boxBounds;
7026
- if (width || height)
7027
- this.__drawPathByBox(new PathCreator(path));
7152
+ if (width || height) {
7153
+ pen.set(path = []);
7154
+ this.__drawPathByBox(pen);
7155
+ }
7028
7156
  }
7029
7157
  return curve ? PathConvert.toCanvasData(path, true) : path;
7030
7158
  }
@@ -7096,6 +7224,9 @@ let UI = UI_1 = class UI extends Leaf {
7096
7224
  __decorate([
7097
7225
  dataProcessor(UIData)
7098
7226
  ], UI.prototype, "__", void 0);
7227
+ __decorate([
7228
+ zoomLayerType()
7229
+ ], UI.prototype, "zoomLayer", void 0);
7099
7230
  __decorate([
7100
7231
  dataType('')
7101
7232
  ], UI.prototype, "id", void 0);
@@ -7114,6 +7245,12 @@ __decorate([
7114
7245
  __decorate([
7115
7246
  opacityType(true)
7116
7247
  ], UI.prototype, "visible", void 0);
7248
+ __decorate([
7249
+ stateType(false)
7250
+ ], UI.prototype, "selected", void 0);
7251
+ __decorate([
7252
+ stateType(false)
7253
+ ], UI.prototype, "disabled", void 0);
7117
7254
  __decorate([
7118
7255
  dataType(false)
7119
7256
  ], UI.prototype, "locked", void 0);
@@ -7261,6 +7398,24 @@ __decorate([
7261
7398
  __decorate([
7262
7399
  effectType()
7263
7400
  ], UI.prototype, "grayscale", void 0);
7401
+ __decorate([
7402
+ dataType()
7403
+ ], UI.prototype, "normalStyle", void 0);
7404
+ __decorate([
7405
+ dataType()
7406
+ ], UI.prototype, "hoverStyle", void 0);
7407
+ __decorate([
7408
+ dataType()
7409
+ ], UI.prototype, "pressStyle", void 0);
7410
+ __decorate([
7411
+ dataType()
7412
+ ], UI.prototype, "focusStyle", void 0);
7413
+ __decorate([
7414
+ dataType()
7415
+ ], UI.prototype, "selectedStyle", void 0);
7416
+ __decorate([
7417
+ dataType()
7418
+ ], UI.prototype, "disabledStyle", void 0);
7264
7419
  __decorate([
7265
7420
  rewrite(Leaf.prototype.reset)
7266
7421
  ], UI.prototype, "reset", null);
@@ -7297,7 +7452,7 @@ let Group = class Group extends UI {
7297
7452
  super.set(data);
7298
7453
  let child;
7299
7454
  children.forEach(childData => {
7300
- child = UICreator.get(childData.tag, childData);
7455
+ child = childData.__ ? childData : UICreator.get(childData.tag, childData);
7301
7456
  this.add(child);
7302
7457
  });
7303
7458
  data.children = children;
@@ -7346,7 +7501,6 @@ let Leafer = class Leafer extends Group {
7346
7501
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
7347
7502
  constructor(userConfig, data) {
7348
7503
  super(data);
7349
- this.zoomLayer = this;
7350
7504
  this.config = {
7351
7505
  type: 'design',
7352
7506
  start: true,
@@ -7359,7 +7513,6 @@ let Leafer = class Leafer extends Group {
7359
7513
  move: {
7360
7514
  holdSpaceKey: true,
7361
7515
  holdMiddleKey: true,
7362
- dragOut: true,
7363
7516
  autoDistance: 2
7364
7517
  }
7365
7518
  };
@@ -7490,9 +7643,6 @@ let Leafer = class Leafer extends Group {
7490
7643
  this.leafer = leafer;
7491
7644
  this.__level = 1;
7492
7645
  }
7493
- setZoomLayer(zoomLayer) {
7494
- this.zoomLayer = zoomLayer;
7495
- }
7496
7646
  __checkAutoLayout(config) {
7497
7647
  if (!config.width || !config.height) {
7498
7648
  this.autoLayout = new AutoBounds(config);
@@ -7578,13 +7728,19 @@ let Leafer = class Leafer extends Group {
7578
7728
  this.nextRender(() => this.interaction.updateCursor());
7579
7729
  }
7580
7730
  }
7581
- waitReady(item) {
7731
+ waitReady(item, bind) {
7732
+ if (bind)
7733
+ item = item.bind(bind);
7582
7734
  this.ready ? item() : this.__readyWait.push(item);
7583
7735
  }
7584
- waitViewReady(item) {
7736
+ waitViewReady(item, bind) {
7737
+ if (bind)
7738
+ item = item.bind(bind);
7585
7739
  this.viewReady ? item() : this.__viewReadyWait.push(item);
7586
7740
  }
7587
- waitViewCompleted(item) {
7741
+ waitViewCompleted(item, bind) {
7742
+ if (bind)
7743
+ item = item.bind(bind);
7588
7744
  this.__viewCompletedWait.push(item);
7589
7745
  if (this.viewCompleted) {
7590
7746
  this.__checkViewCompleted(false);
@@ -7594,7 +7750,9 @@ let Leafer = class Leafer extends Group {
7594
7750
  this.start();
7595
7751
  }
7596
7752
  }
7597
- nextRender(item, off) {
7753
+ nextRender(item, bind, off) {
7754
+ if (bind)
7755
+ item = item.bind(bind);
7598
7756
  const list = this.__nextRenderWait;
7599
7757
  if (off) {
7600
7758
  for (let i = 0; i < list.length; i++) {
@@ -7608,6 +7766,15 @@ let Leafer = class Leafer extends Group {
7608
7766
  list.push(item);
7609
7767
  }
7610
7768
  }
7769
+ zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7770
+ validScale(changeScale) {
7771
+ const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
7772
+ if (absScale < min)
7773
+ changeScale = min / scaleX;
7774
+ else if (absScale > max)
7775
+ changeScale = max / scaleX;
7776
+ return changeScale;
7777
+ }
7611
7778
  __checkUpdateLayout() {
7612
7779
  this.__layout.update();
7613
7780
  }
@@ -8680,17 +8847,21 @@ KeyEvent = __decorate([
8680
8847
  function design(leafer) {
8681
8848
  if (leafer.isApp)
8682
8849
  return;
8683
- leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => leafer.zoomLayer.move(e.moveX, e.moveY)), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
8850
+ leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
8851
+ let { moveX, moveY } = e;
8852
+ if (leafer.config.move.scroll) {
8853
+ if (Math.abs(moveX) > Math.abs(moveY))
8854
+ moveY = 0;
8855
+ else
8856
+ moveX = 0;
8857
+ }
8858
+ leafer.zoomLayer.move(moveX, moveY);
8859
+ }), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
8684
8860
  const { zoomLayer } = leafer;
8685
- const { scaleX } = zoomLayer.__, { min, max } = leafer.app.config.zoom;
8686
- let { scale } = e, absScale = Math.abs(scaleX * scale);
8687
- if (absScale < min)
8688
- scale = min / scaleX;
8689
- else if (absScale > max)
8690
- scale = max / scaleX;
8691
- if (scale !== 1) {
8692
- PointHelper.scaleOf(zoomLayer, e, scale);
8693
- zoomLayer.scale = scaleX * scale;
8861
+ const changeScale = leafer.validScale(e.scale);
8862
+ if (changeScale !== 1) {
8863
+ PointHelper.scaleOf(zoomLayer, e, changeScale);
8864
+ zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
8694
8865
  }
8695
8866
  }));
8696
8867
  }
@@ -8734,6 +8905,7 @@ class Transformer {
8734
8905
  const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
8735
8906
  data.path = path;
8736
8907
  this.moveData = Object.assign(Object.assign({}, data), { moveX: 0, moveY: 0 });
8908
+ interaction.cancelHover();
8737
8909
  interaction.emit(MoveEvent.START, this.moveData);
8738
8910
  }
8739
8911
  data.path = this.moveData.path;
@@ -8747,6 +8919,7 @@ class Transformer {
8747
8919
  const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
8748
8920
  data.path = path;
8749
8921
  this.zoomData = Object.assign(Object.assign({}, data), { scale: 1 });
8922
+ interaction.cancelHover();
8750
8923
  interaction.emit(ZoomEvent.START, this.zoomData);
8751
8924
  }
8752
8925
  data.path = this.zoomData.path;
@@ -8760,6 +8933,7 @@ class Transformer {
8760
8933
  const { path } = interaction.selector.getByPoint(data, interaction.hitRadius);
8761
8934
  data.path = path;
8762
8935
  this.rotateData = Object.assign(Object.assign({}, data), { rotation: 0 });
8936
+ interaction.cancelHover();
8763
8937
  interaction.emit(RotateEvent.START, this.rotateData);
8764
8938
  }
8765
8939
  data.path = this.rotateData.path;
@@ -8877,6 +9051,7 @@ class Dragger {
8877
9051
  this.dragEndReal();
8878
9052
  this.downData = this.interaction.downData;
8879
9053
  this.dragData = getDragEventData(data, data, data);
9054
+ this.canAnimate = this.canDragOut = true;
8880
9055
  }
8881
9056
  getList() {
8882
9057
  const { proxy } = this.interaction.selector;
@@ -8889,9 +9064,6 @@ class Dragger {
8889
9064
  interaction.pointerCancel();
8890
9065
  return;
8891
9066
  }
8892
- else {
8893
- this.canAnimate = true;
8894
- }
8895
9067
  if (!this.moving && canDrag) {
8896
9068
  if (this.moving = interaction.moveMode || interaction.isHoldRightKey)
8897
9069
  interaction.emit(MoveEvent.START, this.dragData);
@@ -8942,13 +9114,14 @@ class Dragger {
8942
9114
  const list = this.getList();
8943
9115
  if (list.length && running) {
8944
9116
  const { moveX, moveY } = this.dragData;
8945
- list.forEach(leaf => LeafHelper.moveWorld(leaf, moveX, moveY));
9117
+ list.forEach(leaf => leaf.moveWorld(moveX, moveY));
8946
9118
  }
8947
9119
  }
8948
9120
  dragOverOrOut(data) {
8949
9121
  const { interaction } = this;
8950
9122
  const { dragOverPath } = this;
8951
9123
  const { path } = data;
9124
+ this.dragOverPath = path;
8952
9125
  if (dragOverPath) {
8953
9126
  if (path.indexAt(0) !== dragOverPath.indexAt(0)) {
8954
9127
  interaction.emit(DragEvent.OUT, data, dragOverPath);
@@ -8958,7 +9131,6 @@ class Dragger {
8958
9131
  else {
8959
9132
  interaction.emit(DragEvent.OVER, data, path);
8960
9133
  }
8961
- this.dragOverPath = path;
8962
9134
  }
8963
9135
  dragEnterOrLeave(data) {
8964
9136
  const { interaction } = this;
@@ -8972,7 +9144,7 @@ class Dragger {
8972
9144
  if (!this.dragData)
8973
9145
  return;
8974
9146
  const { moveX, moveY } = this.dragData;
8975
- if (this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
9147
+ if (this.interaction.config.move.dragAnimate && this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
8976
9148
  data = Object.assign({}, data);
8977
9149
  speed = (speed || (data.pointerType === 'touch' ? 2 : 1)) * 0.9;
8978
9150
  PointHelper.move(data, moveX * speed, moveY * speed);
@@ -9006,12 +9178,11 @@ class Dragger {
9006
9178
  animate(func, off) {
9007
9179
  const animateWait = func || this.animateWait;
9008
9180
  if (animateWait)
9009
- this.interaction.target.nextRender(animateWait, off);
9181
+ this.interaction.target.nextRender(animateWait, null, off);
9010
9182
  this.animateWait = func;
9011
9183
  }
9012
9184
  swipe(data, endDragData) {
9013
- const { interaction } = this;
9014
- const { downData } = interaction;
9185
+ const { interaction, downData } = this;
9015
9186
  if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
9016
9187
  const swipeData = getSwipeEventData(downData, this.dragData, endDragData);
9017
9188
  this.interaction.emit(swipeData.type, swipeData);
@@ -9034,9 +9205,9 @@ class Dragger {
9034
9205
  this.autoMoveOnDragOut(data);
9035
9206
  }
9036
9207
  autoMoveOnDragOut(data) {
9037
- const { interaction, downData } = this;
9208
+ const { interaction, downData, canDragOut } = this;
9038
9209
  const { autoDistance, dragOut } = interaction.config.move;
9039
- if (!dragOut || !autoDistance)
9210
+ if (!dragOut || !canDragOut || !autoDistance)
9040
9211
  return;
9041
9212
  const bounds = interaction.shrinkCanvasBounds;
9042
9213
  const { x, y } = bounds;
@@ -9112,12 +9283,16 @@ function emitAppChildren(leaf, type, data, capture, excludePath) {
9112
9283
  function emitEvent(leaf, type, data, capture, excludePath) {
9113
9284
  if (leaf.destroyed)
9114
9285
  return true;
9115
- if (leaf.__.hitSelf && leaf.hasEvent(type, capture) && !exclude(leaf, excludePath)) {
9116
- data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
9117
- const event = EventCreator.get(type, data);
9118
- leaf.emitEvent(event, capture);
9119
- if (event.isStop)
9120
- return true;
9286
+ if (leaf.__.hitSelf && !exclude(leaf, excludePath)) {
9287
+ if (State.updateEventStyle)
9288
+ State.updateEventStyle(leaf, type);
9289
+ if (leaf.hasEvent(type, capture)) {
9290
+ data.phase = capture ? 1 : ((leaf === data.target) ? 2 : 3);
9291
+ const event = EventCreator.get(type, data);
9292
+ leaf.emitEvent(event, capture);
9293
+ if (event.isStop)
9294
+ return true;
9295
+ }
9121
9296
  }
9122
9297
  return false;
9123
9298
  }
@@ -9142,7 +9317,6 @@ const MultiTouchHelper = {
9142
9317
 
9143
9318
  const config = {
9144
9319
  wheel: {
9145
- zoomMode: false,
9146
9320
  zoomSpeed: 0.5,
9147
9321
  moveSpeed: 0.5,
9148
9322
  rotateSpeed: 0.5,
@@ -9151,14 +9325,12 @@ const config = {
9151
9325
  },
9152
9326
  pointer: {
9153
9327
  hitRadius: 5,
9154
- through: false,
9155
9328
  tapTime: 120,
9156
9329
  longPressTime: 800,
9157
9330
  transformTime: 500,
9158
9331
  dragHover: true,
9159
9332
  dragDistance: 2,
9160
9333
  swipeDistance: 20,
9161
- ignoreMove: false,
9162
9334
  preventDefaultMenu: true
9163
9335
  },
9164
9336
  cursor: {}
@@ -9201,17 +9373,19 @@ class InteractionBase {
9201
9373
  this.updateDownData(data);
9202
9374
  if (useDefaultPath)
9203
9375
  data.path = this.defaultPath;
9204
- this.emit(PointerEvent.BEFORE_DOWN, data);
9205
- this.emit(PointerEvent.DOWN, data);
9206
9376
  this.downTime = Date.now();
9207
- this.dragger.setDragData(data);
9208
- if (PointerButton.left(data)) {
9209
- this.tapWait();
9210
- this.longPressWait(data);
9211
- }
9212
- else if (PointerButton.right(data)) {
9213
- this.waitMenuTap = true;
9377
+ if (this.downed = !this.moveMode) {
9378
+ this.emit(PointerEvent.BEFORE_DOWN, data);
9379
+ this.emit(PointerEvent.DOWN, data);
9380
+ if (PointerButton.left(data)) {
9381
+ this.tapWait();
9382
+ this.longPressWait(data);
9383
+ }
9384
+ else if (PointerButton.right(data)) {
9385
+ this.waitMenuTap = true;
9386
+ }
9214
9387
  }
9388
+ this.dragger.setDragData(data);
9215
9389
  this.updateCursor(data);
9216
9390
  }
9217
9391
  pointerMove(data) {
@@ -9219,14 +9393,18 @@ class InteractionBase {
9219
9393
  data = this.hoverData;
9220
9394
  if (!data)
9221
9395
  return;
9222
- if (this.downData)
9396
+ const { downData } = this;
9397
+ if (downData)
9223
9398
  PointerButton.defaultLeft(data);
9224
9399
  const hit = this.canvas.bounds.hitPoint(data);
9225
- if (hit || this.downData) {
9226
- if (hit && !this.downData && PointerButton.left(data))
9400
+ if (hit || downData) {
9401
+ if (hit && !downData && PointerButton.left(data)) {
9227
9402
  this.pointerDown(data, true);
9403
+ this.dragger.canDragOut = false;
9404
+ }
9228
9405
  this.pointerMoveReal(data);
9229
- this.dragger.checkDragOut(data);
9406
+ if (downData)
9407
+ this.dragger.checkDragOut(data);
9230
9408
  }
9231
9409
  }
9232
9410
  pointerMoveReal(data) {
@@ -9242,9 +9420,11 @@ class InteractionBase {
9242
9420
  }
9243
9421
  if (!this.dragger.moving) {
9244
9422
  this.updateHoverData(data);
9423
+ if (this.moveMode)
9424
+ data.path = this.defaultPath;
9245
9425
  this.emit(PointerEvent.MOVE, data);
9246
- this.pointerOverOrOut(data);
9247
- this.pointerEnterOrLeave(data);
9426
+ if (!(this.dragging && !this.config.pointer.dragHover))
9427
+ this.pointerHover(data);
9248
9428
  if (this.dragger.dragging) {
9249
9429
  this.dragger.dragOverOrOut(data);
9250
9430
  this.dragger.dragEnterOrLeave(data);
@@ -9253,20 +9433,24 @@ class InteractionBase {
9253
9433
  this.updateCursor(this.downData || data);
9254
9434
  }
9255
9435
  pointerUp(data) {
9436
+ const { downData, oldDownData } = this;
9256
9437
  if (!data)
9257
- data = this.downData;
9258
- if (!this.downData)
9438
+ data = downData;
9439
+ if (!downData)
9259
9440
  return;
9260
9441
  PointerButton.defaultLeft(data);
9261
9442
  this.findPath(data);
9262
- this.emit(PointerEvent.BEFORE_UP, data);
9263
- this.emit(PointerEvent.UP, data);
9264
- if (this.oldDownData)
9265
- this.emit(PointerEvent.UP, this.oldDownData, undefined, data.path);
9266
- this.emit(PointerEvent.UP, this.downData, undefined, data.path);
9267
- this.touchLeave(data);
9268
- this.tap(data);
9269
- this.menuTap(data);
9443
+ if (this.downed) {
9444
+ this.downed = false;
9445
+ this.emit(PointerEvent.BEFORE_UP, data);
9446
+ this.emit(PointerEvent.UP, data);
9447
+ if (oldDownData)
9448
+ this.emit(PointerEvent.UP, oldDownData, undefined, data.path);
9449
+ this.emit(PointerEvent.UP, downData, undefined, data.path);
9450
+ this.touchLeave(data);
9451
+ this.tap(data);
9452
+ this.menuTap(data);
9453
+ }
9270
9454
  this.dragger.dragEnd(data);
9271
9455
  this.downData = this.oldDownData = null;
9272
9456
  this.updateCursor(data);
@@ -9306,8 +9490,10 @@ class InteractionBase {
9306
9490
  this.downKeyMap[code] = true;
9307
9491
  Keyboard.setDownCode(code);
9308
9492
  this.emit(KeyEvent.HOLD, data, this.defaultPath);
9309
- if (this.moveMode)
9493
+ if (this.moveMode) {
9494
+ this.cancelHover();
9310
9495
  this.updateCursor();
9496
+ }
9311
9497
  }
9312
9498
  this.emit(KeyEvent.DOWN, data, this.defaultPath);
9313
9499
  }
@@ -9319,32 +9505,34 @@ class InteractionBase {
9319
9505
  if (this.cursor === 'grab')
9320
9506
  this.updateCursor();
9321
9507
  }
9508
+ pointerHover(data) {
9509
+ this.pointerOverOrOut(data);
9510
+ this.pointerEnterOrLeave(data);
9511
+ }
9322
9512
  pointerOverOrOut(data) {
9323
- if (this.dragger.moving)
9324
- return;
9325
- if (this.dragging && !this.config.pointer.dragHover)
9326
- return;
9327
9513
  const { path } = data;
9328
- if (this.overPath) {
9329
- if (path.indexAt(0) !== this.overPath.indexAt(0)) {
9330
- this.emit(PointerEvent.OUT, data, this.overPath);
9514
+ const { overPath } = this;
9515
+ this.overPath = path;
9516
+ if (overPath) {
9517
+ if (path.indexAt(0) !== overPath.indexAt(0)) {
9518
+ this.emit(PointerEvent.OUT, data, overPath);
9331
9519
  this.emit(PointerEvent.OVER, data, path);
9332
9520
  }
9333
9521
  }
9334
9522
  else {
9335
9523
  this.emit(PointerEvent.OVER, data, path);
9336
9524
  }
9337
- this.overPath = path;
9338
9525
  }
9339
9526
  pointerEnterOrLeave(data) {
9340
- if (this.dragger.moving)
9341
- return;
9342
- if (this.dragging && !this.config.pointer.dragHover)
9343
- return;
9344
- const { path } = data;
9345
- this.emit(PointerEvent.LEAVE, data, this.enterPath, path);
9346
- this.emit(PointerEvent.ENTER, data, path, this.enterPath);
9527
+ let { path } = data;
9528
+ if (this.downData && !this.moveMode) {
9529
+ path = path.clone();
9530
+ this.downData.path.forEach(leaf => path.add(leaf));
9531
+ }
9532
+ const { enterPath } = this;
9347
9533
  this.enterPath = path;
9534
+ this.emit(PointerEvent.LEAVE, data, enterPath, path);
9535
+ this.emit(PointerEvent.ENTER, data, path, enterPath);
9348
9536
  }
9349
9537
  touchLeave(data) {
9350
9538
  if (data.pointerType === 'touch') {
@@ -9400,6 +9588,23 @@ class InteractionBase {
9400
9588
  isDrag(leaf) {
9401
9589
  return this.dragger.getList().has(leaf);
9402
9590
  }
9591
+ isPress(leaf) {
9592
+ const { downData, oldDownData } = this;
9593
+ return this.downed && ((downData && downData.path.has(leaf)) || (oldDownData && oldDownData.path.has(leaf)));
9594
+ }
9595
+ isHover(leaf) {
9596
+ return this.enterPath && this.enterPath.has(leaf);
9597
+ }
9598
+ isFocus(leaf) {
9599
+ return this.focusData === leaf;
9600
+ }
9601
+ cancelHover() {
9602
+ const { hoverData } = this;
9603
+ if (hoverData) {
9604
+ hoverData.path = this.defaultPath;
9605
+ this.pointerHover(hoverData);
9606
+ }
9607
+ }
9403
9608
  updateDownData(data, options) {
9404
9609
  const { downData } = this;
9405
9610
  if (!data && downData)
@@ -9433,8 +9638,7 @@ class InteractionBase {
9433
9638
  }
9434
9639
  else if (!data)
9435
9640
  return;
9436
- let leaf;
9437
- let cursor;
9641
+ let leaf, cursor;
9438
9642
  const { path } = data;
9439
9643
  for (let i = 0, len = path.length; i < len; i++) {
9440
9644
  leaf = path.list[i];
@@ -10139,10 +10343,6 @@ function createData(leafPaint, image, paint, box) {
10139
10343
  case 'strench':
10140
10344
  if (!sameBox)
10141
10345
  width = box.width, height = box.height;
10142
- if (box.x || box.y) {
10143
- data.transform = get$3();
10144
- translate(data.transform, box.x, box.y);
10145
- }
10146
10346
  break;
10147
10347
  case 'clip':
10148
10348
  if (offset || scaleX || rotation)
@@ -10160,6 +10360,12 @@ function createData(leafPaint, image, paint, box) {
10160
10360
  if (!sameBox || rotation)
10161
10361
  fillOrFitMode(data, mode, box, width, height, rotation);
10162
10362
  }
10363
+ if (!data.transform) {
10364
+ if (box.x || box.y) {
10365
+ data.transform = get$3();
10366
+ translate(data.transform, box.x, box.y);
10367
+ }
10368
+ }
10163
10369
  data.width = width;
10164
10370
  data.height = height;
10165
10371
  if (opacity)
@@ -10177,8 +10383,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10177
10383
  leafPaint = cache.leafPaint;
10178
10384
  }
10179
10385
  else {
10180
- leafPaint = { type: paint.type };
10181
- leafPaint.image = image;
10386
+ leafPaint = { type: paint.type, image };
10182
10387
  cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
10183
10388
  }
10184
10389
  if (firstUse || image.loading)
@@ -10195,9 +10400,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10195
10400
  onLoadError(ui, event, image.error);
10196
10401
  }
10197
10402
  else {
10403
+ ignoreRender(ui, true);
10198
10404
  if (firstUse)
10199
10405
  onLoad(ui, event);
10200
10406
  leafPaint.loadId = image.load(() => {
10407
+ ignoreRender(ui, false);
10201
10408
  if (!ui.destroyed) {
10202
10409
  if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
10203
10410
  ui.forceUpdate('surface');
@@ -10205,6 +10412,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10205
10412
  }
10206
10413
  leafPaint.loadId = null;
10207
10414
  }, (error) => {
10415
+ ignoreRender(ui, false);
10208
10416
  onLoadError(ui, event, error);
10209
10417
  leafPaint.loadId = null;
10210
10418
  });
@@ -10244,11 +10452,16 @@ function emit(ui, type, data) {
10244
10452
  if (ui.hasEvent(type))
10245
10453
  ui.emitEvent(new ImageEvent(type, data));
10246
10454
  }
10455
+ function ignoreRender(ui, value) {
10456
+ const { leafer } = ui;
10457
+ if (leafer && leafer.viewReady)
10458
+ leafer.renderer.ignore = value;
10459
+ }
10247
10460
 
10248
10461
  const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
10249
10462
  const { ceil, abs: abs$1 } = Math;
10250
10463
  function createPattern(ui, paint, pixelRatio) {
10251
- let { scaleX, scaleY } = ui.__world;
10464
+ let { scaleX, scaleY } = ui.__nowWorld;
10252
10465
  const id = scaleX + '-' + scaleY;
10253
10466
  if (paint.patternId !== id && !ui.destroyed) {
10254
10467
  scaleX = abs$1(scaleX);
@@ -10310,7 +10523,7 @@ function createPattern(ui, paint, pixelRatio) {
10310
10523
 
10311
10524
  const { abs } = Math;
10312
10525
  function checkImage(ui, canvas, paint, allowPaint) {
10313
- const { scaleX, scaleY } = ui.__world;
10526
+ const { scaleX, scaleY } = ui.__nowWorld;
10314
10527
  if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
10315
10528
  return false;
10316
10529
  }
@@ -10352,7 +10565,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
10352
10565
  if (!paint.patternTask) {
10353
10566
  paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
10354
10567
  paint.patternTask = null;
10355
- if (canvas.bounds.hit(ui.__world))
10568
+ if (canvas.bounds.hit(ui.__nowWorld))
10356
10569
  createPattern(ui, paint, canvas.pixelRatio);
10357
10570
  ui.forceUpdate('surface');
10358
10571
  }), 300);
@@ -10589,8 +10802,8 @@ function innerShadow(ui, current, shape) {
10589
10802
 
10590
10803
  function blur(ui, current, origin) {
10591
10804
  const { blur } = ui.__;
10592
- origin.setWorldBlur(blur * ui.__world.a);
10593
- origin.copyWorldToInner(current, ui.__world, ui.__layout.renderBounds);
10805
+ origin.setWorldBlur(blur * ui.__nowWorld.a);
10806
+ origin.copyWorldToInner(current, ui.__nowWorld, ui.__layout.renderBounds);
10594
10807
  origin.filter = 'none';
10595
10808
  }
10596
10809
 
@@ -11221,10 +11434,10 @@ const ExportModule = {
11221
11434
  renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
11222
11435
  }
11223
11436
  else {
11224
- const location = options.location || ((isLeafer || isFrame) ? 'inner' : 'local');
11437
+ let relative = options.relative || (isLeafer ? 'inner' : 'local');
11225
11438
  scaleX = worldTransform.scaleX;
11226
11439
  scaleY = worldTransform.scaleY;
11227
- switch (location) {
11440
+ switch (relative) {
11228
11441
  case 'inner':
11229
11442
  matrix.set(worldTransform).invert();
11230
11443
  break;
@@ -11237,11 +11450,18 @@ const ExportModule = {
11237
11450
  scaleX = 1;
11238
11451
  scaleY = 1;
11239
11452
  break;
11453
+ case 'page':
11454
+ relative = leaf.leafer;
11455
+ default:
11456
+ matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert();
11457
+ const l = relative.worldTransform;
11458
+ scaleX /= scaleX / l.scaleX;
11459
+ scaleY /= scaleY / l.scaleY;
11240
11460
  }
11241
- renderBounds = leaf.getBounds('render', location);
11461
+ renderBounds = leaf.getBounds('render', relative);
11242
11462
  }
11243
- const { x, y, width, height } = new Bounds(renderBounds).scale(scale).ceil();
11244
- let canvas = Creator.canvas({ width, height, pixelRatio });
11463
+ const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
11464
+ let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
11245
11465
  const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
11246
11466
  if (slice) {
11247
11467
  leaf = leafer;
@@ -11336,4 +11556,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
11336
11556
  }
11337
11557
  };
11338
11558
 
11339
- export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule };
11559
+ export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, useCanvas, useModule, zoomLayerType };