leafer-ui 2.2.6 → 2.2.7
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/web.cjs +72 -48
- package/dist/web.esm.js +71 -49
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +100 -68
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +100 -70
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.js
CHANGED
|
@@ -4513,7 +4513,7 @@ var LeaferUI = function(exports) {
|
|
|
4513
4513
|
const LeafHelper = {
|
|
4514
4514
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4515
4515
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged) waitAutoLayout = true;
|
|
4516
|
-
updateMatrix$
|
|
4516
|
+
updateMatrix$1(leaf, checkAutoLayout, waitAutoLayout);
|
|
4517
4517
|
if (leaf.isBranch) {
|
|
4518
4518
|
const {children: children} = leaf;
|
|
4519
4519
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4534,9 +4534,10 @@ var LeaferUI = function(exports) {
|
|
|
4534
4534
|
if (layout.matrixChanged) leaf.__updateLocalMatrix();
|
|
4535
4535
|
if (!layout.waitAutoLayout) leaf.__updateWorldMatrix();
|
|
4536
4536
|
},
|
|
4537
|
-
updateBounds(leaf) {
|
|
4537
|
+
updateBounds(leaf, noUpdateSize) {
|
|
4538
4538
|
const layout = leaf.__layout;
|
|
4539
4539
|
if (layout.boundsChanged) leaf.__updateLocalBounds();
|
|
4540
|
+
if (noUpdateSize) layout.resized = undefined;
|
|
4540
4541
|
if (!layout.waitAutoLayout) leaf.__updateWorldBounds();
|
|
4541
4542
|
},
|
|
4542
4543
|
updateAllWorldOpacity(leaf) {
|
|
@@ -4559,7 +4560,7 @@ var LeaferUI = function(exports) {
|
|
|
4559
4560
|
}
|
|
4560
4561
|
},
|
|
4561
4562
|
updateAllChange(leaf) {
|
|
4562
|
-
updateChange
|
|
4563
|
+
updateChange(leaf);
|
|
4563
4564
|
if (leaf.isBranch) {
|
|
4564
4565
|
const {children: children} = leaf;
|
|
4565
4566
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4729,7 +4730,7 @@ var LeaferUI = function(exports) {
|
|
|
4729
4730
|
}
|
|
4730
4731
|
};
|
|
4731
4732
|
const L = LeafHelper;
|
|
4732
|
-
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$
|
|
4733
|
+
const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$1, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange} = L;
|
|
4733
4734
|
function getTempLocal(t, worldPoint) {
|
|
4734
4735
|
t.updateLayout();
|
|
4735
4736
|
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
@@ -4770,7 +4771,7 @@ var LeaferUI = function(exports) {
|
|
|
4770
4771
|
if (target.__.mask) findMask = 1;
|
|
4771
4772
|
return findMask < 0 ? null : (findMask && (findMask = -1), true);
|
|
4772
4773
|
}
|
|
4773
|
-
const {updateBounds: updateBounds$
|
|
4774
|
+
const {updateBounds: updateBounds$2} = LeafHelper;
|
|
4774
4775
|
const BranchHelper = {
|
|
4775
4776
|
sort(a, b) {
|
|
4776
4777
|
return a.__.zIndex === b.__.zIndex ? a.__tempNumber - b.__tempNumber : a.__.zIndex - b.__.zIndex;
|
|
@@ -4830,10 +4831,10 @@ var LeaferUI = function(exports) {
|
|
|
4830
4831
|
branch = branchStack[i];
|
|
4831
4832
|
children = branch.children;
|
|
4832
4833
|
for (let j = 0, len = children.length; j < len; j++) {
|
|
4833
|
-
updateBounds$
|
|
4834
|
+
updateBounds$2(children[j]);
|
|
4834
4835
|
}
|
|
4835
4836
|
if (exclude && exclude === branch) continue;
|
|
4836
|
-
updateBounds$
|
|
4837
|
+
updateBounds$2(branch);
|
|
4837
4838
|
}
|
|
4838
4839
|
},
|
|
4839
4840
|
move(branch, x, y) {
|
|
@@ -4892,7 +4893,7 @@ var LeaferUI = function(exports) {
|
|
|
4892
4893
|
}
|
|
4893
4894
|
}
|
|
4894
4895
|
};
|
|
4895
|
-
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$
|
|
4896
|
+
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$1} = LeafHelper;
|
|
4896
4897
|
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
|
|
4897
4898
|
const localContent = "_localContentBounds";
|
|
4898
4899
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
@@ -4996,7 +4997,7 @@ var LeaferUI = function(exports) {
|
|
|
4996
4997
|
}
|
|
4997
4998
|
update() {
|
|
4998
4999
|
const {leaf: leaf} = this, {leafer: leafer} = leaf;
|
|
4999
|
-
if (leaf.isApp) return updateBounds$
|
|
5000
|
+
if (leaf.isApp) return updateBounds$1(leaf);
|
|
5000
5001
|
if (leafer) {
|
|
5001
5002
|
if (leafer.ready) leafer.watcher.changed && leafer.layouter.layout(); else leafer.start();
|
|
5002
5003
|
} else {
|
|
@@ -5658,9 +5659,12 @@ var LeaferUI = function(exports) {
|
|
|
5658
5659
|
}
|
|
5659
5660
|
},
|
|
5660
5661
|
emitPropertyEvent(type, name, oldValue, newValue) {
|
|
5661
|
-
const
|
|
5662
|
-
|
|
5663
|
-
|
|
5662
|
+
const {leafer: leafer} = this;
|
|
5663
|
+
if (leafer.config.trackChanges || leafer.zoomLayer === this) {
|
|
5664
|
+
const event = new PropertyEvent(type, this, name, oldValue, newValue);
|
|
5665
|
+
this.isLeafer || this.hasEvent(type) && this.emitEvent(event);
|
|
5666
|
+
leafer.emitEvent(event);
|
|
5667
|
+
} else leafer.watcher.add(this);
|
|
5664
5668
|
},
|
|
5665
5669
|
__realSetAttr(name, newValue) {
|
|
5666
5670
|
const data = this.__;
|
|
@@ -5701,8 +5705,8 @@ var LeaferUI = function(exports) {
|
|
|
5701
5705
|
this.__layout.matrixChanged = undefined;
|
|
5702
5706
|
}
|
|
5703
5707
|
};
|
|
5704
|
-
const {updateMatrix: updateMatrix
|
|
5705
|
-
const {updateBounds: updateBounds
|
|
5708
|
+
const {updateMatrix: updateMatrix, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
|
|
5709
|
+
const {updateBounds: updateBounds} = BranchHelper;
|
|
5706
5710
|
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
|
|
5707
5711
|
const {toBounds: toBounds} = PathBounds;
|
|
5708
5712
|
const LeafBounds = {
|
|
@@ -5802,14 +5806,14 @@ var LeaferUI = function(exports) {
|
|
|
5802
5806
|
if (this.__layout.childrenSortChanged) this.__updateSortChildren();
|
|
5803
5807
|
if (this.__layout.boxChanged) this.__updateFlowLayout();
|
|
5804
5808
|
updateAllMatrix$2(this);
|
|
5805
|
-
updateBounds
|
|
5809
|
+
updateBounds(this, this);
|
|
5806
5810
|
if (this.__.__autoSide) this.__updateBoxBounds(true);
|
|
5807
5811
|
} else {
|
|
5808
5812
|
updateAllMatrix$2(this);
|
|
5809
|
-
updateBounds
|
|
5813
|
+
updateBounds(this, this);
|
|
5810
5814
|
}
|
|
5811
5815
|
} else {
|
|
5812
|
-
updateMatrix
|
|
5816
|
+
updateMatrix(this);
|
|
5813
5817
|
}
|
|
5814
5818
|
},
|
|
5815
5819
|
__updateNaturalSize() {
|
|
@@ -6465,9 +6469,12 @@ var LeaferUI = function(exports) {
|
|
|
6465
6469
|
if (this.isFrame) child.__bindFrame(null);
|
|
6466
6470
|
}
|
|
6467
6471
|
__emitChildEvent(type, child) {
|
|
6468
|
-
const
|
|
6469
|
-
if (
|
|
6470
|
-
|
|
6472
|
+
const {leafer: leafer} = this;
|
|
6473
|
+
if (leafer.config.trackChanges || leafer.zoomLayer === this) {
|
|
6474
|
+
const event = new ChildEvent(type, child, this);
|
|
6475
|
+
if (this.hasEvent(type) && !this.isLeafer) this.emitEvent(event);
|
|
6476
|
+
leafer.emitEvent(event);
|
|
6477
|
+
} else leafer.watcher.addChild(child, this, type);
|
|
6471
6478
|
}
|
|
6472
6479
|
};
|
|
6473
6480
|
exports.Branch = __decorate([ useModule(BranchRender) ], exports.Branch);
|
|
@@ -6616,7 +6623,7 @@ var LeaferUI = function(exports) {
|
|
|
6616
6623
|
this.levelMap = null;
|
|
6617
6624
|
}
|
|
6618
6625
|
}
|
|
6619
|
-
const version = "2.2.
|
|
6626
|
+
const version = "2.2.7";
|
|
6620
6627
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6621
6628
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6622
6629
|
set zIndex(zIndex) {
|
|
@@ -6930,6 +6937,7 @@ var LeaferUI = function(exports) {
|
|
|
6930
6937
|
}
|
|
6931
6938
|
constructor(target, userConfig) {
|
|
6932
6939
|
this.totalTimes = 0;
|
|
6940
|
+
this.changed = 0;
|
|
6933
6941
|
this.config = {};
|
|
6934
6942
|
this.__updatedList = new LeafList;
|
|
6935
6943
|
this.target = target;
|
|
@@ -6949,8 +6957,10 @@ var LeaferUI = function(exports) {
|
|
|
6949
6957
|
this.disabled = true;
|
|
6950
6958
|
}
|
|
6951
6959
|
update() {
|
|
6952
|
-
this.changed
|
|
6953
|
-
|
|
6960
|
+
if (this.changed < 100) {
|
|
6961
|
+
this.changed++;
|
|
6962
|
+
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
6963
|
+
}
|
|
6954
6964
|
}
|
|
6955
6965
|
__onAttrChange(event) {
|
|
6956
6966
|
this.add(event.target);
|
|
@@ -6959,18 +6969,21 @@ var LeaferUI = function(exports) {
|
|
|
6959
6969
|
if (this.config.usePartLayout) this.__updatedList.add(leaf);
|
|
6960
6970
|
this.update();
|
|
6961
6971
|
}
|
|
6962
|
-
|
|
6972
|
+
addChild(child, parent, eventType) {
|
|
6963
6973
|
if (this.config.usePartLayout) {
|
|
6964
|
-
if (
|
|
6974
|
+
if (eventType === ChildEvent.ADD) {
|
|
6965
6975
|
this.hasAdd = true;
|
|
6966
|
-
this.__pushChild(
|
|
6976
|
+
this.__pushChild(child);
|
|
6967
6977
|
} else {
|
|
6968
6978
|
this.hasRemove = true;
|
|
6969
|
-
this.__updatedList.add(
|
|
6979
|
+
this.__updatedList.add(parent);
|
|
6970
6980
|
}
|
|
6971
6981
|
}
|
|
6972
6982
|
this.update();
|
|
6973
6983
|
}
|
|
6984
|
+
__onChildEvent(event) {
|
|
6985
|
+
this.addChild(event.child, event.parent, event.type);
|
|
6986
|
+
}
|
|
6974
6987
|
__pushChild(child) {
|
|
6975
6988
|
this.__updatedList.add(child);
|
|
6976
6989
|
if (child.isBranch) this.__loopChildren(child);
|
|
@@ -6985,7 +6998,8 @@ var LeaferUI = function(exports) {
|
|
|
6985
6998
|
}));
|
|
6986
6999
|
this.__updatedList = new LeafList;
|
|
6987
7000
|
this.totalTimes++;
|
|
6988
|
-
this.
|
|
7001
|
+
this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
7002
|
+
this.changed = 0;
|
|
6989
7003
|
}
|
|
6990
7004
|
__listenEvents() {
|
|
6991
7005
|
this.__eventIds = [ this.target.on_([ [ PropertyEvent.CHANGE, this.__onAttrChange, this ], [ [ ChildEvent.ADD, ChildEvent.REMOVE ], this.__onChildEvent, this ], [ WatchEvent.REQUEST, this.__onRquestData, this ] ]) ];
|
|
@@ -7003,45 +7017,56 @@ var LeaferUI = function(exports) {
|
|
|
7003
7017
|
}
|
|
7004
7018
|
const {updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange} = LeafHelper;
|
|
7005
7019
|
const {pushAllChildBranch: pushAllChildBranch, pushAllParent: pushAllParent} = BranchHelper;
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
if (
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
if (
|
|
7019
|
-
|
|
7020
|
+
const LayouterHelper = {
|
|
7021
|
+
updateMatrix(updateList, levelList) {
|
|
7022
|
+
let index = 0, leaf, layout;
|
|
7023
|
+
const {list: list} = updateList;
|
|
7024
|
+
while (index < list.length) {
|
|
7025
|
+
leaf = list[index];
|
|
7026
|
+
layout = leaf.__layout;
|
|
7027
|
+
if (levelList.without(leaf) && !layout.proxyZoom) {
|
|
7028
|
+
if (layout.matrixChanged) {
|
|
7029
|
+
updateAllMatrix$1(leaf, true);
|
|
7030
|
+
if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
|
|
7031
|
+
push(leaf, levelList);
|
|
7032
|
+
} else if (layout.boundsChanged) {
|
|
7033
|
+
if (leaf.isBranch) leaf.__tempNumber = 0;
|
|
7034
|
+
push(leaf, levelList);
|
|
7035
|
+
}
|
|
7020
7036
|
}
|
|
7037
|
+
index++;
|
|
7021
7038
|
}
|
|
7022
|
-
}
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7039
|
+
},
|
|
7040
|
+
updateBounds(boundsList) {
|
|
7041
|
+
let index = 0, level, list, branch, children;
|
|
7042
|
+
const {levels: levels, levelMap: levelMap} = boundsList;
|
|
7043
|
+
boundsList.sort(true);
|
|
7044
|
+
while (index < levels.length) {
|
|
7045
|
+
level = levels[index];
|
|
7046
|
+
list = levelMap[level];
|
|
7047
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
7048
|
+
branch = list[i];
|
|
7049
|
+
if (branch.isBranch && branch.__tempNumber) {
|
|
7050
|
+
children = branch.children;
|
|
7051
|
+
for (let j = 0, jLen = children.length; j < jLen; j++) {
|
|
7052
|
+
if (!children[j].isBranch) {
|
|
7053
|
+
updateOneBounds(children[j]);
|
|
7054
|
+
}
|
|
7036
7055
|
}
|
|
7037
7056
|
}
|
|
7057
|
+
updateOneBounds(branch);
|
|
7038
7058
|
}
|
|
7039
|
-
|
|
7059
|
+
index++;
|
|
7040
7060
|
}
|
|
7041
|
-
}
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7061
|
+
},
|
|
7062
|
+
updateChange(updateList) {
|
|
7063
|
+
updateList.list.forEach(updateOneChange);
|
|
7064
|
+
},
|
|
7065
|
+
push: push
|
|
7066
|
+
};
|
|
7067
|
+
function push(leaf, levelList) {
|
|
7068
|
+
levelList.add(leaf);
|
|
7069
|
+
pushAllParent(leaf, levelList);
|
|
7045
7070
|
}
|
|
7046
7071
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
7047
7072
|
class LayoutBlockData {
|
|
@@ -7143,9 +7168,9 @@ var LeaferUI = function(exports) {
|
|
|
7143
7168
|
target.emitEvent(new LayoutEvent(BEFORE, blocks, this.times));
|
|
7144
7169
|
this.extraBlock = null;
|
|
7145
7170
|
updateList.sort();
|
|
7146
|
-
updateMatrix(updateList, this.__levelList);
|
|
7147
|
-
updateBounds(this.__levelList);
|
|
7148
|
-
updateChange(updateList);
|
|
7171
|
+
LayouterHelper.updateMatrix(updateList, this.__levelList);
|
|
7172
|
+
LayouterHelper.updateBounds(this.__levelList);
|
|
7173
|
+
LayouterHelper.updateChange(updateList);
|
|
7149
7174
|
if (this.extraBlock) blocks.push(this.extraBlock);
|
|
7150
7175
|
blocks.forEach(item => item.setAfter());
|
|
7151
7176
|
target.emitEvent(new LayoutEvent(LAYOUT, blocks, this.times));
|
|
@@ -7175,11 +7200,16 @@ var LeaferUI = function(exports) {
|
|
|
7175
7200
|
if (target.isBranch) BranchHelper.updateBounds(target); else LeafHelper.updateBounds(target);
|
|
7176
7201
|
updateAllChange(target);
|
|
7177
7202
|
}
|
|
7178
|
-
addExtra(leaf) {
|
|
7203
|
+
addExtra(leaf, updateBounds) {
|
|
7179
7204
|
if (!this.__updatedList.has(leaf)) {
|
|
7180
7205
|
const {updatedList: updatedList, beforeBounds: beforeBounds} = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
|
|
7181
7206
|
updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
|
|
7182
7207
|
updatedList.add(leaf);
|
|
7208
|
+
if (updateBounds) {
|
|
7209
|
+
const list = this.__levelList;
|
|
7210
|
+
LayouterHelper.push(leaf, list);
|
|
7211
|
+
list.sort(true);
|
|
7212
|
+
}
|
|
7183
7213
|
}
|
|
7184
7214
|
}
|
|
7185
7215
|
createBlock(data) {
|
|
@@ -7497,7 +7527,7 @@ var LeaferUI = function(exports) {
|
|
|
7497
7527
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
7498
7528
|
find = list[i];
|
|
7499
7529
|
if (ignoreHittable || LeafHelper.worldHittable(find)) {
|
|
7500
|
-
this.hitChild(find, find.hitThrough ? this.point : point);
|
|
7530
|
+
this.hitChild(find, find.hitThrough ? this.point : point, find.mask && find.parent && find.parent.__onlyHitMask);
|
|
7501
7531
|
if (findList.length) {
|
|
7502
7532
|
if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
|
|
7503
7533
|
findList.reset();
|
|
@@ -7596,7 +7626,7 @@ var LeaferUI = function(exports) {
|
|
|
7596
7626
|
}
|
|
7597
7627
|
const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
|
|
7598
7628
|
if (hitThrough) {
|
|
7599
|
-
const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
|
|
7629
|
+
const index = findList.list.findIndex(item => hitThrough === "parent" ? LeafHelper.hasParent(item.parent, child.parent) : item[hitThrough] === child[hitThrough]);
|
|
7600
7630
|
if (index > 0) return findList.addAt(leaf, index);
|
|
7601
7631
|
}
|
|
7602
7632
|
findList.add(leaf);
|
|
@@ -8492,6 +8522,7 @@ var LeaferUI = function(exports) {
|
|
|
8492
8522
|
start: true,
|
|
8493
8523
|
hittable: true,
|
|
8494
8524
|
smooth: true,
|
|
8525
|
+
trackChanges: true,
|
|
8495
8526
|
lazySpeard: 100
|
|
8496
8527
|
};
|
|
8497
8528
|
this.leafs = 0;
|
|
@@ -11485,7 +11516,7 @@ var LeaferUI = function(exports) {
|
|
|
11485
11516
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
11486
11517
|
if (data.__autoSide) {
|
|
11487
11518
|
ui.forceUpdate();
|
|
11488
|
-
LeafHelper.updateBounds(ui);
|
|
11519
|
+
LeafHelper.updateBounds(ui, true);
|
|
11489
11520
|
ui.__layout.boundsChanged = true;
|
|
11490
11521
|
if (ui.__proxyData) {
|
|
11491
11522
|
ui.setProxyAttr("width", data.width);
|
|
@@ -12677,6 +12708,7 @@ var LeaferUI = function(exports) {
|
|
|
12677
12708
|
exports.Keyboard = Keyboard;
|
|
12678
12709
|
exports.LayoutEvent = LayoutEvent;
|
|
12679
12710
|
exports.Layouter = Layouter;
|
|
12711
|
+
exports.LayouterHelper = LayouterHelper;
|
|
12680
12712
|
exports.LeafBounds = LeafBounds;
|
|
12681
12713
|
exports.LeafBoundsHelper = LeafBoundsHelper;
|
|
12682
12714
|
exports.LeafData = LeafData;
|