leafer-ui 2.2.5 → 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/README.md +11 -5
- 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 +126 -83
- 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 +128 -85
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -167,7 +167,10 @@ LeaferJS 是一个持续打磨了五年的原创开源引擎。我们致力于
|
|
|
167
167
|
|
|
168
168
|
<p><h3 align="center">金牌赞助商</h3></p>
|
|
169
169
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 15px;">
|
|
170
|
-
<a target="_blank" href="https://
|
|
170
|
+
<a target="_blank" href="https://yzllq.com/">
|
|
171
|
+
<img width="180" title="一个浏览器打开多组账户 - 电商、自媒体、矩阵营销的便捷账户管理方式" src="https://www.leaferjs.com/image/sponsor/gold/yzllq.png" loading="lazy" />
|
|
172
|
+
</a>
|
|
173
|
+
<a target="_blank" href="https://easysearch.cn">
|
|
171
174
|
<img width="180" title="Easysearch - 企业级的分布式搜索型数据库" src="https://www.leaferjs.com/image/sponsor/gold/easysearch.png" loading="lazy" />
|
|
172
175
|
</a>
|
|
173
176
|
<a target="_blank" href="https://boardos.online">
|
|
@@ -210,11 +213,11 @@ LeaferJS 是一个持续打磨了五年的原创开源引擎。我们致力于
|
|
|
210
213
|
|
|
211
214
|
<p><h3 align="center">银牌赞助</h3></p>
|
|
212
215
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 5px;">
|
|
213
|
-
|
|
216
|
+
<a target="_blank" href="">
|
|
214
217
|
<img width="40" title="怜生" src="https://www.pxgrow.com/image/user/default/3.jpg" loading="lazy" />
|
|
215
218
|
</a>
|
|
216
|
-
<a target="_blank" href="https://pro.kuaitu.cc
|
|
217
|
-
<img width="40" title="快图设计" src="https://www.pxgrow.com/image/
|
|
219
|
+
<a target="_blank" href="https://pro.kuaitu.cc">
|
|
220
|
+
<img width="40" title="快图设计" src="https://www.pxgrow.com/image/user/default/7.jpg" loading="lazy" />
|
|
218
221
|
</a>
|
|
219
222
|
<a target="_blank" href="">
|
|
220
223
|
<img width="40" title="black" src="https://api.pxgrow.com/uploads/avatar/249/AzA/4v/u.jpg" loading="lazy" />
|
|
@@ -264,6 +267,9 @@ LeaferJS 是一个持续打磨了五年的原创开源引擎。我们致力于
|
|
|
264
267
|
<a target="_blank" href="">
|
|
265
268
|
<img width="40" title="😊" src="https://www.pxgrow.com/image/sponsor/user/79.jpg" loading="lazy" />
|
|
266
269
|
</a>
|
|
270
|
+
<a target="_blank" href="https://pro.kuaitu.cc/">
|
|
271
|
+
<img width="40" title="快图设计" src="https://www.pxgrow.com/image/sponsor/user/72.jpg" loading="lazy" />
|
|
272
|
+
</a>
|
|
267
273
|
<a target="_blank" href="">
|
|
268
274
|
<img width="40" title="ycteng" src="https://www.pxgrow.com/image/sponsor/user/purple.png" loading="lazy" />
|
|
269
275
|
</a>
|
|
@@ -388,7 +394,7 @@ LeaferJS 是一个持续打磨了五年的原创开源引擎。我们致力于
|
|
|
388
394
|
|
|
389
395
|
<p><h3 align="center">铜牌赞助</h3></p>
|
|
390
396
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 15px;">
|
|
391
|
-
|
|
397
|
+
parox2014 QGG 小白不白 用户zw8T394C 用户zw8T398C 龙眼吃多了上火 用户zw8T392T 用户z89CSw69 用户CzP9SCAz Kim 用户249AzA8v l0f5c7bf 夏先生 yinuo 用户3wTwAz78 用户zw8T39zT 用户249AzA82 用户CzP9SCvz 用户39A334xT 用户3wTwAz3x 用户zw8T39zC 稀饭、微凉 用户CzP9SCT4 便宜VPS服务器 菲鸽 szhua Cheng Suezp beyond 用户3PvP2S63 o Arvin finallycc 用户39A3346C 大雷 用户CzP9SC4z 随风 用户z89CSwT9 用户3wTwAzCx UPMuling 军杨 桔子雨工作室 用户zw8T37xC 前端炒饭仔 用户z89CSw46 崮生 互动矩阵 ZhanYoHo 何佳Q coderhyh 早上好啊 快图设计 do 毛哥哥 迅排设计 用户z89CSw86 糖果 南城以北 黑色摩天仑 Charm Lauginwing 在路上 Jerry 张余🌈 李狗嗨。💢 用户zw8T376T 用户249AzA2v ʚ LMT ɞ 格子 等等 goosen F4nniu 梁福斌 江万江 杨超 ToB Dev 前端之虎陈随易 A☀️云☀️A zhk 爱发电用户_c9c82 轻简历 爱发电用户_0fac0 wangyesheji.cn 风间 爱发电用户_Tqsm 爱发电用户_6KpE 星小志 zwm 爱发电用户_3725c Noth1ng 纳西妲の√ 爱发电用户_Ahb9 爱发电用户_7617d 冷漠 爱发电用户_9RXB 今日值得读 爱发电用户_49sT 爱发电用户_NFCS 爱发电用户_43ad8 爱发电用户_30455 砖吐筷筷 xiaozhang 爱发电用户_b47b3 longbow1998 爱发电用户_5d755 爱发电用户_b76b8 爱发电用户_e70c2 xiaou@截图工具 ousiri 爱发电用户_039dc 花祁 爱发电用户_99f39 坤坤 爱发电用户_X6hp ycteng 曹吉美爸爸 啸沧海 Ronny 爱发电用户_UXEV Biu 王志强 SaltedFish 爱发电用户_76f9d PD.新城คิดถึง 糖颂缘冥倾 ALBERT. 爱发电用户_Pbm7 Leafer 赞助我们 </p>
|
|
392
398
|
|
|
393
399
|
## License
|
|
394
400
|
|
package/dist/web.cjs
CHANGED
|
@@ -374,6 +374,7 @@ class Watcher {
|
|
|
374
374
|
}
|
|
375
375
|
constructor(target, userConfig) {
|
|
376
376
|
this.totalTimes = 0;
|
|
377
|
+
this.changed = 0;
|
|
377
378
|
this.config = {};
|
|
378
379
|
this.__updatedList = new core.LeafList;
|
|
379
380
|
this.target = target;
|
|
@@ -393,8 +394,10 @@ class Watcher {
|
|
|
393
394
|
this.disabled = true;
|
|
394
395
|
}
|
|
395
396
|
update() {
|
|
396
|
-
this.changed
|
|
397
|
-
|
|
397
|
+
if (this.changed < 100) {
|
|
398
|
+
this.changed++;
|
|
399
|
+
if (this.running) this.target.emit(core.RenderEvent.REQUEST);
|
|
400
|
+
}
|
|
398
401
|
}
|
|
399
402
|
__onAttrChange(event) {
|
|
400
403
|
this.add(event.target);
|
|
@@ -403,18 +406,21 @@ class Watcher {
|
|
|
403
406
|
if (this.config.usePartLayout) this.__updatedList.add(leaf);
|
|
404
407
|
this.update();
|
|
405
408
|
}
|
|
406
|
-
|
|
409
|
+
addChild(child, parent, eventType) {
|
|
407
410
|
if (this.config.usePartLayout) {
|
|
408
|
-
if (
|
|
411
|
+
if (eventType === core.ChildEvent.ADD) {
|
|
409
412
|
this.hasAdd = true;
|
|
410
|
-
this.__pushChild(
|
|
413
|
+
this.__pushChild(child);
|
|
411
414
|
} else {
|
|
412
415
|
this.hasRemove = true;
|
|
413
|
-
this.__updatedList.add(
|
|
416
|
+
this.__updatedList.add(parent);
|
|
414
417
|
}
|
|
415
418
|
}
|
|
416
419
|
this.update();
|
|
417
420
|
}
|
|
421
|
+
__onChildEvent(event) {
|
|
422
|
+
this.addChild(event.child, event.parent, event.type);
|
|
423
|
+
}
|
|
418
424
|
__pushChild(child) {
|
|
419
425
|
this.__updatedList.add(child);
|
|
420
426
|
if (child.isBranch) this.__loopChildren(child);
|
|
@@ -429,7 +435,8 @@ class Watcher {
|
|
|
429
435
|
}));
|
|
430
436
|
this.__updatedList = new core.LeafList;
|
|
431
437
|
this.totalTimes++;
|
|
432
|
-
this.
|
|
438
|
+
this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
439
|
+
this.changed = 0;
|
|
433
440
|
}
|
|
434
441
|
__listenEvents() {
|
|
435
442
|
this.__eventIds = [ this.target.on_([ [ core.PropertyEvent.CHANGE, this.__onAttrChange, this ], [ [ core.ChildEvent.ADD, core.ChildEvent.REMOVE ], this.__onChildEvent, this ], [ core.WatchEvent.REQUEST, this.__onRquestData, this ] ]) ];
|
|
@@ -450,47 +457,57 @@ const {updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, update
|
|
|
450
457
|
|
|
451
458
|
const {pushAllChildBranch: pushAllChildBranch, pushAllParent: pushAllParent} = core.BranchHelper;
|
|
452
459
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (
|
|
466
|
-
|
|
460
|
+
const LayouterHelper = {
|
|
461
|
+
updateMatrix(updateList, levelList) {
|
|
462
|
+
let index = 0, leaf, layout;
|
|
463
|
+
const {list: list} = updateList;
|
|
464
|
+
while (index < list.length) {
|
|
465
|
+
leaf = list[index];
|
|
466
|
+
layout = leaf.__layout;
|
|
467
|
+
if (levelList.without(leaf) && !layout.proxyZoom) {
|
|
468
|
+
if (layout.matrixChanged) {
|
|
469
|
+
updateAllMatrix$1(leaf, true);
|
|
470
|
+
if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
|
|
471
|
+
push(leaf, levelList);
|
|
472
|
+
} else if (layout.boundsChanged) {
|
|
473
|
+
if (leaf.isBranch) leaf.__tempNumber = 0;
|
|
474
|
+
push(leaf, levelList);
|
|
475
|
+
}
|
|
467
476
|
}
|
|
477
|
+
index++;
|
|
468
478
|
}
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
479
|
+
},
|
|
480
|
+
updateBounds(boundsList) {
|
|
481
|
+
let index = 0, level, list, branch, children;
|
|
482
|
+
const {levels: levels, levelMap: levelMap} = boundsList;
|
|
483
|
+
boundsList.sort(true);
|
|
484
|
+
while (index < levels.length) {
|
|
485
|
+
level = levels[index];
|
|
486
|
+
list = levelMap[level];
|
|
487
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
488
|
+
branch = list[i];
|
|
489
|
+
if (branch.isBranch && branch.__tempNumber) {
|
|
490
|
+
children = branch.children;
|
|
491
|
+
for (let j = 0, jLen = children.length; j < jLen; j++) {
|
|
492
|
+
if (!children[j].isBranch) {
|
|
493
|
+
updateOneBounds(children[j]);
|
|
494
|
+
}
|
|
484
495
|
}
|
|
485
496
|
}
|
|
497
|
+
updateOneBounds(branch);
|
|
486
498
|
}
|
|
487
|
-
|
|
499
|
+
index++;
|
|
488
500
|
}
|
|
489
|
-
}
|
|
490
|
-
|
|
501
|
+
},
|
|
502
|
+
updateChange(updateList) {
|
|
503
|
+
updateList.list.forEach(updateOneChange);
|
|
504
|
+
},
|
|
505
|
+
push: push
|
|
506
|
+
};
|
|
491
507
|
|
|
492
|
-
function
|
|
493
|
-
|
|
508
|
+
function push(leaf, levelList) {
|
|
509
|
+
levelList.add(leaf);
|
|
510
|
+
pushAllParent(leaf, levelList);
|
|
494
511
|
}
|
|
495
512
|
|
|
496
513
|
const {worldBounds: worldBounds} = core.LeafBoundsHelper;
|
|
@@ -597,9 +614,9 @@ class Layouter {
|
|
|
597
614
|
target.emitEvent(new core.LayoutEvent(BEFORE, blocks, this.times));
|
|
598
615
|
this.extraBlock = null;
|
|
599
616
|
updateList.sort();
|
|
600
|
-
updateMatrix(updateList, this.__levelList);
|
|
601
|
-
updateBounds(this.__levelList);
|
|
602
|
-
updateChange(updateList);
|
|
617
|
+
LayouterHelper.updateMatrix(updateList, this.__levelList);
|
|
618
|
+
LayouterHelper.updateBounds(this.__levelList);
|
|
619
|
+
LayouterHelper.updateChange(updateList);
|
|
603
620
|
if (this.extraBlock) blocks.push(this.extraBlock);
|
|
604
621
|
blocks.forEach(item => item.setAfter());
|
|
605
622
|
target.emitEvent(new core.LayoutEvent(LAYOUT, blocks, this.times));
|
|
@@ -629,11 +646,16 @@ class Layouter {
|
|
|
629
646
|
if (target.isBranch) core.BranchHelper.updateBounds(target); else core.LeafHelper.updateBounds(target);
|
|
630
647
|
updateAllChange(target);
|
|
631
648
|
}
|
|
632
|
-
addExtra(leaf) {
|
|
649
|
+
addExtra(leaf, updateBounds) {
|
|
633
650
|
if (!this.__updatedList.has(leaf)) {
|
|
634
651
|
const {updatedList: updatedList, beforeBounds: beforeBounds} = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
|
|
635
652
|
updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
|
|
636
653
|
updatedList.add(leaf);
|
|
654
|
+
if (updateBounds) {
|
|
655
|
+
const list = this.__levelList;
|
|
656
|
+
LayouterHelper.push(leaf, list);
|
|
657
|
+
list.sort(true);
|
|
658
|
+
}
|
|
637
659
|
}
|
|
638
660
|
}
|
|
639
661
|
createBlock(data) {
|
|
@@ -958,7 +980,7 @@ class Picker {
|
|
|
958
980
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
959
981
|
find = list[i];
|
|
960
982
|
if (ignoreHittable || core.LeafHelper.worldHittable(find)) {
|
|
961
|
-
this.hitChild(find, find.hitThrough ? this.point : point);
|
|
983
|
+
this.hitChild(find, find.hitThrough ? this.point : point, find.mask && find.parent && find.parent.__onlyHitMask);
|
|
962
984
|
if (findList.length) {
|
|
963
985
|
if (find.isBranchLeaf && list.some(item => item !== find && core.LeafHelper.hasParent(item, find))) {
|
|
964
986
|
findList.reset();
|
|
@@ -1057,7 +1079,7 @@ class Picker {
|
|
|
1057
1079
|
}
|
|
1058
1080
|
const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
|
|
1059
1081
|
if (hitThrough) {
|
|
1060
|
-
const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
|
|
1082
|
+
const index = findList.list.findIndex(item => hitThrough === "parent" ? core.LeafHelper.hasParent(item.parent, child.parent) : item[hitThrough] === child[hitThrough]);
|
|
1061
1083
|
if (index > 0) return findList.addAt(leaf, index);
|
|
1062
1084
|
}
|
|
1063
1085
|
findList.add(leaf);
|
|
@@ -1892,7 +1914,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
1892
1914
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
1893
1915
|
if (data.__autoSide) {
|
|
1894
1916
|
ui.forceUpdate();
|
|
1895
|
-
core.LeafHelper.updateBounds(ui);
|
|
1917
|
+
core.LeafHelper.updateBounds(ui, true);
|
|
1896
1918
|
ui.__layout.boundsChanged = true;
|
|
1897
1919
|
if (ui.__proxyData) {
|
|
1898
1920
|
ui.setProxyAttr("width", data.width);
|
|
@@ -3196,6 +3218,8 @@ exports.Interaction = Interaction;
|
|
|
3196
3218
|
|
|
3197
3219
|
exports.Layouter = Layouter;
|
|
3198
3220
|
|
|
3221
|
+
exports.LayouterHelper = LayouterHelper;
|
|
3222
|
+
|
|
3199
3223
|
exports.LeaferCanvas = LeaferCanvas;
|
|
3200
3224
|
|
|
3201
3225
|
exports.Picker = Picker;
|
package/dist/web.esm.js
CHANGED
|
@@ -378,6 +378,7 @@ class Watcher {
|
|
|
378
378
|
}
|
|
379
379
|
constructor(target, userConfig) {
|
|
380
380
|
this.totalTimes = 0;
|
|
381
|
+
this.changed = 0;
|
|
381
382
|
this.config = {};
|
|
382
383
|
this.__updatedList = new LeafList;
|
|
383
384
|
this.target = target;
|
|
@@ -397,8 +398,10 @@ class Watcher {
|
|
|
397
398
|
this.disabled = true;
|
|
398
399
|
}
|
|
399
400
|
update() {
|
|
400
|
-
this.changed
|
|
401
|
-
|
|
401
|
+
if (this.changed < 100) {
|
|
402
|
+
this.changed++;
|
|
403
|
+
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
404
|
+
}
|
|
402
405
|
}
|
|
403
406
|
__onAttrChange(event) {
|
|
404
407
|
this.add(event.target);
|
|
@@ -407,18 +410,21 @@ class Watcher {
|
|
|
407
410
|
if (this.config.usePartLayout) this.__updatedList.add(leaf);
|
|
408
411
|
this.update();
|
|
409
412
|
}
|
|
410
|
-
|
|
413
|
+
addChild(child, parent, eventType) {
|
|
411
414
|
if (this.config.usePartLayout) {
|
|
412
|
-
if (
|
|
415
|
+
if (eventType === ChildEvent.ADD) {
|
|
413
416
|
this.hasAdd = true;
|
|
414
|
-
this.__pushChild(
|
|
417
|
+
this.__pushChild(child);
|
|
415
418
|
} else {
|
|
416
419
|
this.hasRemove = true;
|
|
417
|
-
this.__updatedList.add(
|
|
420
|
+
this.__updatedList.add(parent);
|
|
418
421
|
}
|
|
419
422
|
}
|
|
420
423
|
this.update();
|
|
421
424
|
}
|
|
425
|
+
__onChildEvent(event) {
|
|
426
|
+
this.addChild(event.child, event.parent, event.type);
|
|
427
|
+
}
|
|
422
428
|
__pushChild(child) {
|
|
423
429
|
this.__updatedList.add(child);
|
|
424
430
|
if (child.isBranch) this.__loopChildren(child);
|
|
@@ -433,7 +439,8 @@ class Watcher {
|
|
|
433
439
|
}));
|
|
434
440
|
this.__updatedList = new LeafList;
|
|
435
441
|
this.totalTimes++;
|
|
436
|
-
this.
|
|
442
|
+
this.hasVisible = this.hasRemove = this.hasAdd = false;
|
|
443
|
+
this.changed = 0;
|
|
437
444
|
}
|
|
438
445
|
__listenEvents() {
|
|
439
446
|
this.__eventIds = [ this.target.on_([ [ PropertyEvent.CHANGE, this.__onAttrChange, this ], [ [ ChildEvent.ADD, ChildEvent.REMOVE ], this.__onChildEvent, this ], [ WatchEvent.REQUEST, this.__onRquestData, this ] ]) ];
|
|
@@ -454,47 +461,57 @@ const {updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, update
|
|
|
454
461
|
|
|
455
462
|
const {pushAllChildBranch: pushAllChildBranch, pushAllParent: pushAllParent} = BranchHelper;
|
|
456
463
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
if (
|
|
470
|
-
|
|
464
|
+
const LayouterHelper = {
|
|
465
|
+
updateMatrix(updateList, levelList) {
|
|
466
|
+
let index = 0, leaf, layout;
|
|
467
|
+
const {list: list} = updateList;
|
|
468
|
+
while (index < list.length) {
|
|
469
|
+
leaf = list[index];
|
|
470
|
+
layout = leaf.__layout;
|
|
471
|
+
if (levelList.without(leaf) && !layout.proxyZoom) {
|
|
472
|
+
if (layout.matrixChanged) {
|
|
473
|
+
updateAllMatrix$1(leaf, true);
|
|
474
|
+
if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
|
|
475
|
+
push(leaf, levelList);
|
|
476
|
+
} else if (layout.boundsChanged) {
|
|
477
|
+
if (leaf.isBranch) leaf.__tempNumber = 0;
|
|
478
|
+
push(leaf, levelList);
|
|
479
|
+
}
|
|
471
480
|
}
|
|
481
|
+
index++;
|
|
472
482
|
}
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
483
|
+
},
|
|
484
|
+
updateBounds(boundsList) {
|
|
485
|
+
let index = 0, level, list, branch, children;
|
|
486
|
+
const {levels: levels, levelMap: levelMap} = boundsList;
|
|
487
|
+
boundsList.sort(true);
|
|
488
|
+
while (index < levels.length) {
|
|
489
|
+
level = levels[index];
|
|
490
|
+
list = levelMap[level];
|
|
491
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
492
|
+
branch = list[i];
|
|
493
|
+
if (branch.isBranch && branch.__tempNumber) {
|
|
494
|
+
children = branch.children;
|
|
495
|
+
for (let j = 0, jLen = children.length; j < jLen; j++) {
|
|
496
|
+
if (!children[j].isBranch) {
|
|
497
|
+
updateOneBounds(children[j]);
|
|
498
|
+
}
|
|
488
499
|
}
|
|
489
500
|
}
|
|
501
|
+
updateOneBounds(branch);
|
|
490
502
|
}
|
|
491
|
-
|
|
503
|
+
index++;
|
|
492
504
|
}
|
|
493
|
-
}
|
|
494
|
-
|
|
505
|
+
},
|
|
506
|
+
updateChange(updateList) {
|
|
507
|
+
updateList.list.forEach(updateOneChange);
|
|
508
|
+
},
|
|
509
|
+
push: push
|
|
510
|
+
};
|
|
495
511
|
|
|
496
|
-
function
|
|
497
|
-
|
|
512
|
+
function push(leaf, levelList) {
|
|
513
|
+
levelList.add(leaf);
|
|
514
|
+
pushAllParent(leaf, levelList);
|
|
498
515
|
}
|
|
499
516
|
|
|
500
517
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
@@ -601,9 +618,9 @@ class Layouter {
|
|
|
601
618
|
target.emitEvent(new LayoutEvent(BEFORE, blocks, this.times));
|
|
602
619
|
this.extraBlock = null;
|
|
603
620
|
updateList.sort();
|
|
604
|
-
updateMatrix(updateList, this.__levelList);
|
|
605
|
-
updateBounds(this.__levelList);
|
|
606
|
-
updateChange(updateList);
|
|
621
|
+
LayouterHelper.updateMatrix(updateList, this.__levelList);
|
|
622
|
+
LayouterHelper.updateBounds(this.__levelList);
|
|
623
|
+
LayouterHelper.updateChange(updateList);
|
|
607
624
|
if (this.extraBlock) blocks.push(this.extraBlock);
|
|
608
625
|
blocks.forEach(item => item.setAfter());
|
|
609
626
|
target.emitEvent(new LayoutEvent(LAYOUT, blocks, this.times));
|
|
@@ -633,11 +650,16 @@ class Layouter {
|
|
|
633
650
|
if (target.isBranch) BranchHelper.updateBounds(target); else LeafHelper.updateBounds(target);
|
|
634
651
|
updateAllChange(target);
|
|
635
652
|
}
|
|
636
|
-
addExtra(leaf) {
|
|
653
|
+
addExtra(leaf, updateBounds) {
|
|
637
654
|
if (!this.__updatedList.has(leaf)) {
|
|
638
655
|
const {updatedList: updatedList, beforeBounds: beforeBounds} = this.extraBlock || (this.extraBlock = new LayoutBlockData([]));
|
|
639
656
|
updatedList.length ? beforeBounds.add(leaf.__world) : beforeBounds.set(leaf.__world);
|
|
640
657
|
updatedList.add(leaf);
|
|
658
|
+
if (updateBounds) {
|
|
659
|
+
const list = this.__levelList;
|
|
660
|
+
LayouterHelper.push(leaf, list);
|
|
661
|
+
list.sort(true);
|
|
662
|
+
}
|
|
641
663
|
}
|
|
642
664
|
}
|
|
643
665
|
createBlock(data) {
|
|
@@ -962,7 +984,7 @@ class Picker {
|
|
|
962
984
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
963
985
|
find = list[i];
|
|
964
986
|
if (ignoreHittable || LeafHelper.worldHittable(find)) {
|
|
965
|
-
this.hitChild(find, find.hitThrough ? this.point : point);
|
|
987
|
+
this.hitChild(find, find.hitThrough ? this.point : point, find.mask && find.parent && find.parent.__onlyHitMask);
|
|
966
988
|
if (findList.length) {
|
|
967
989
|
if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
|
|
968
990
|
findList.reset();
|
|
@@ -1061,7 +1083,7 @@ class Picker {
|
|
|
1061
1083
|
}
|
|
1062
1084
|
const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
|
|
1063
1085
|
if (hitThrough) {
|
|
1064
|
-
const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
|
|
1086
|
+
const index = findList.list.findIndex(item => hitThrough === "parent" ? LeafHelper.hasParent(item.parent, child.parent) : item[hitThrough] === child[hitThrough]);
|
|
1065
1087
|
if (index > 0) return findList.addAt(leaf, index);
|
|
1066
1088
|
}
|
|
1067
1089
|
findList.add(leaf);
|
|
@@ -1896,7 +1918,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
1896
1918
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
1897
1919
|
if (data.__autoSide) {
|
|
1898
1920
|
ui.forceUpdate();
|
|
1899
|
-
LeafHelper.updateBounds(ui);
|
|
1921
|
+
LeafHelper.updateBounds(ui, true);
|
|
1900
1922
|
ui.__layout.boundsChanged = true;
|
|
1901
1923
|
if (ui.__proxyData) {
|
|
1902
1924
|
ui.setProxyAttr("width", data.width);
|
|
@@ -3175,4 +3197,4 @@ Object.assign(Creator, {
|
|
|
3175
3197
|
|
|
3176
3198
|
useCanvas();
|
|
3177
3199
|
|
|
3178
|
-
export { Interaction, Layouter, LeaferCanvas, PathNodeHandleType, Picker, Renderer, Selector, Watcher, useCanvas };
|
|
3200
|
+
export { Interaction, Layouter, LayouterHelper, LeaferCanvas, PathNodeHandleType, Picker, Renderer, Selector, Watcher, useCanvas };
|