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 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://easysearch.cn">
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
- <a target="_blank" href="">
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/sponsor/user/72.jpg" loading="lazy" />
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
- 用户zw8T394C &nbsp;&nbsp;用户zw8T398C &nbsp;&nbsp;龙眼吃多了上火 &nbsp;&nbsp;用户zw8T392T &nbsp;&nbsp;用户z89CSw69 &nbsp;&nbsp;用户CzP9SCAz &nbsp;&nbsp;Kim &nbsp;&nbsp;用户249AzA8v &nbsp;&nbsp;l0f5c7bf &nbsp;&nbsp;夏先生 &nbsp;&nbsp;yinuo &nbsp;&nbsp;用户3wTwAz78 &nbsp;&nbsp;用户zw8T39zT &nbsp;&nbsp;用户249AzA82 &nbsp;&nbsp;用户CzP9SCvz &nbsp;&nbsp;用户39A334xT &nbsp;&nbsp;用户3wTwAz3x &nbsp;&nbsp;用户zw8T39zC &nbsp;&nbsp;稀饭、微凉 &nbsp;&nbsp;用户CzP9SCT4 &nbsp;&nbsp;便宜VPS服务器 &nbsp;&nbsp;菲鸽 &nbsp;&nbsp;szhua &nbsp;&nbsp;Cheng &nbsp;&nbsp;Suezp &nbsp;&nbsp;beyond &nbsp;&nbsp;用户3PvP2S63 &nbsp;&nbsp;o &nbsp;&nbsp;Arvin &nbsp;&nbsp;finallycc &nbsp;&nbsp;用户39A3346C &nbsp;&nbsp;大雷 &nbsp;&nbsp;用户CzP9SC4z &nbsp;&nbsp;随风 &nbsp;&nbsp;用户z89CSwT9 &nbsp;&nbsp;用户3wTwAzCx &nbsp;&nbsp;UPMuling &nbsp;&nbsp;军杨 &nbsp;&nbsp;桔子雨工作室 &nbsp;&nbsp;用户zw8T37xC &nbsp;&nbsp;前端炒饭仔 &nbsp;&nbsp;用户z89CSw46 &nbsp;&nbsp;崮生 &nbsp;&nbsp;互动矩阵 &nbsp;&nbsp;ZhanYoHo &nbsp;&nbsp;何佳Q &nbsp;&nbsp;coderhyh &nbsp;&nbsp;早上好啊 &nbsp;&nbsp;快图设计 &nbsp;&nbsp;do &nbsp;&nbsp;毛哥哥 &nbsp;&nbsp;迅排设计 &nbsp;&nbsp;用���z89CSw86 &nbsp;&nbsp;糖果 &nbsp;&nbsp;南城以北 &nbsp;&nbsp;黑色摩天仑 &nbsp;&nbsp;Charm &nbsp;&nbsp;Lauginwing &nbsp;&nbsp;在路上 &nbsp;&nbsp;Jerry &nbsp;&nbsp;张余🌈 &nbsp;&nbsp;李狗嗨。💢 &nbsp;&nbsp;用户zw8T376T &nbsp;&nbsp;用户249AzA2v &nbsp;&nbsp;ʚ LMT ɞ &nbsp;&nbsp;格子 &nbsp;&nbsp;等等 &nbsp;&nbsp;goosen &nbsp;&nbsp;F4nniu &nbsp;&nbsp;梁福斌 &nbsp;&nbsp;江万江 &nbsp;&nbsp;杨超 &nbsp;&nbsp;ToB Dev &nbsp;&nbsp;前端之虎陈随易 &nbsp;&nbsp;A☀️云☀️A &nbsp;&nbsp;zhk &nbsp;&nbsp;爱发电用户_c9c82 &nbsp;&nbsp;轻简历 &nbsp;&nbsp;爱发电用户_0fac0 &nbsp;&nbsp;wangyesheji.cn &nbsp;&nbsp;风间 &nbsp;&nbsp;爱发电用户_Tqsm &nbsp;&nbsp;爱发电用户_6KpE &nbsp;&nbsp;星小志 &nbsp;&nbsp;zwm &nbsp;&nbsp;爱发电用户_3725c &nbsp;&nbsp;Noth1ng &nbsp;&nbsp;纳西妲の√ &nbsp;&nbsp;爱发电用户_Ahb9 &nbsp;&nbsp;爱发电用户_7617d &nbsp;&nbsp;冷漠 &nbsp;&nbsp;爱发电用户_9RXB &nbsp;&nbsp;今日值得读 &nbsp;&nbsp;爱发电用户_49sT &nbsp;&nbsp;爱发电用户_NFCS &nbsp;&nbsp;爱发电用户_43ad8 &nbsp;&nbsp;爱发电用户_30455 &nbsp;&nbsp;砖吐筷筷 &nbsp;&nbsp;xiaozhang &nbsp;&nbsp;爱发电用户_b47b3 &nbsp;&nbsp;longbow1998 &nbsp;&nbsp;爱发电用户_5d755 &nbsp;&nbsp;爱发电用户_b76b8 &nbsp;&nbsp;爱发电用户_e70c2 &nbsp;&nbsp;xiaou@截图工具 &nbsp;&nbsp;ousiri &nbsp;&nbsp;爱发电用户_039dc &nbsp;&nbsp;花祁 &nbsp;&nbsp;爱发电用户_99f39 &nbsp;&nbsp;坤坤 &nbsp;&nbsp;爱发电用户_X6hp &nbsp;&nbsp;ycteng &nbsp;&nbsp;曹吉美爸爸 &nbsp;&nbsp;啸沧海 &nbsp;&nbsp;Ronny &nbsp;&nbsp;爱发电用户_UXEV &nbsp;&nbsp;Biu &nbsp;&nbsp;王志强 &nbsp;&nbsp;SaltedFish &nbsp;&nbsp;爱发电用户_76f9d &nbsp;&nbsp;PD.新城คิดถึง &nbsp;&nbsp;糖颂缘冥倾 &nbsp;&nbsp;ALBERT. &nbsp;&nbsp;爱发电用户_Pbm7 &nbsp;&nbsp;Leafer &nbsp;&nbsp;赞助我们 &nbsp;&nbsp;</p>
397
+ parox2014 &nbsp;&nbsp;QGG &nbsp;&nbsp;小白不白 &nbsp;&nbsp;用户zw8T394C &nbsp;&nbsp;用户zw8T398C &nbsp;&nbsp;龙眼吃多了上火 &nbsp;&nbsp;用户zw8T392T &nbsp;&nbsp;用户z89CSw69 &nbsp;&nbsp;用户CzP9SCAz &nbsp;&nbsp;Kim &nbsp;&nbsp;用户249AzA8v &nbsp;&nbsp;l0f5c7bf &nbsp;&nbsp;夏先生 &nbsp;&nbsp;yinuo &nbsp;&nbsp;用户3wTwAz78 &nbsp;&nbsp;用户zw8T39zT &nbsp;&nbsp;用户249AzA82 &nbsp;&nbsp;用户CzP9SCvz &nbsp;&nbsp;用户39A334xT &nbsp;&nbsp;用户3wTwAz3x &nbsp;&nbsp;用户zw8T39zC &nbsp;&nbsp;稀饭、微凉 &nbsp;&nbsp;用户CzP9SCT4 &nbsp;&nbsp;便宜VPS服务器 &nbsp;&nbsp;菲鸽 &nbsp;&nbsp;szhua &nbsp;&nbsp;Cheng &nbsp;&nbsp;Suezp &nbsp;&nbsp;beyond &nbsp;&nbsp;用户3PvP2S63 &nbsp;&nbsp;o &nbsp;&nbsp;Arvin &nbsp;&nbsp;finallycc &nbsp;&nbsp;用户39A3346C &nbsp;&nbsp;大雷 &nbsp;&nbsp;用户CzP9SC4z &nbsp;&nbsp;随风 &nbsp;&nbsp;用户z89CSwT9 &nbsp;&nbsp;用户3wTwAzCx &nbsp;&nbsp;UPMuling &nbsp;&nbsp;军杨 &nbsp;&nbsp;桔子雨工作室 &nbsp;&nbsp;用户zw8T37xC &nbsp;&nbsp;前端炒饭仔 &nbsp;&nbsp;用户z89CSw46 &nbsp;&nbsp;崮生 &nbsp;&nbsp;互动矩阵 &nbsp;&nbsp;ZhanYoHo &nbsp;&nbsp;何佳Q &nbsp;&nbsp;coderhyh &nbsp;&nbsp;早上好啊 &nbsp;&nbsp;快图设计 &nbsp;&nbsp;do &nbsp;&nbsp;毛哥哥 &nbsp;&nbsp;迅排设计 &nbsp;&nbsp;用户z89CSw86 &nbsp;&nbsp;糖果 &nbsp;&nbsp;南城以北 &nbsp;&nbsp;黑色摩天仑 &nbsp;&nbsp;Charm &nbsp;&nbsp;Lauginwing &nbsp;&nbsp;在路上 &nbsp;&nbsp;Jerry &nbsp;&nbsp;张余🌈 &nbsp;&nbsp;李狗嗨。💢 &nbsp;&nbsp;用户zw8T376T &nbsp;&nbsp;用户249AzA2v &nbsp;&nbsp;ʚ LMT ɞ &nbsp;&nbsp;格子 &nbsp;&nbsp;等等 &nbsp;&nbsp;goosen &nbsp;&nbsp;F4nniu &nbsp;&nbsp;梁福斌 &nbsp;&nbsp;江万江 &nbsp;&nbsp;杨超 &nbsp;&nbsp;ToB Dev &nbsp;&nbsp;前端之虎陈随易 &nbsp;&nbsp;A☀️云☀️A &nbsp;&nbsp;zhk &nbsp;&nbsp;爱发电用户_c9c82 &nbsp;&nbsp;轻简历 &nbsp;&nbsp;爱发电用户_0fac0 &nbsp;&nbsp;wangyesheji.cn &nbsp;&nbsp;风间 &nbsp;&nbsp;爱发电用户_Tqsm &nbsp;&nbsp;爱发电用户_6KpE &nbsp;&nbsp;星小志 &nbsp;&nbsp;zwm &nbsp;&nbsp;爱发电用户_3725c &nbsp;&nbsp;Noth1ng &nbsp;&nbsp;纳西妲の√ &nbsp;&nbsp;爱发电用户_Ahb9 &nbsp;&nbsp;爱发电用户_7617d &nbsp;&nbsp;冷漠 &nbsp;&nbsp;爱发电用户_9RXB &nbsp;&nbsp;今日值得读 &nbsp;&nbsp;爱发电用户_49sT &nbsp;&nbsp;爱发电用户_NFCS &nbsp;&nbsp;爱发电用户_43ad8 &nbsp;&nbsp;爱发电用户_30455 &nbsp;&nbsp;砖吐筷筷 &nbsp;&nbsp;xiaozhang &nbsp;&nbsp;爱发电用户_b47b3 &nbsp;&nbsp;longbow1998 &nbsp;&nbsp;爱发电用户_5d755 &nbsp;&nbsp;爱发电用户_b76b8 &nbsp;&nbsp;爱发电用户_e70c2 &nbsp;&nbsp;xiaou@截图工具 &nbsp;&nbsp;ousiri &nbsp;&nbsp;爱发电用户_039dc &nbsp;&nbsp;花祁 &nbsp;&nbsp;爱发电用户_99f39 &nbsp;&nbsp;坤坤 &nbsp;&nbsp;爱发电用户_X6hp &nbsp;&nbsp;ycteng &nbsp;&nbsp;曹吉美爸爸 &nbsp;&nbsp;啸沧海 &nbsp;&nbsp;Ronny &nbsp;&nbsp;爱发电用户_UXEV &nbsp;&nbsp;Biu &nbsp;&nbsp;王志强 &nbsp;&nbsp;SaltedFish &nbsp;&nbsp;爱发电用户_76f9d &nbsp;&nbsp;PD.新城คิดถึง &nbsp;&nbsp;糖颂缘冥倾 &nbsp;&nbsp;ALBERT. &nbsp;&nbsp;爱发电用户_Pbm7 &nbsp;&nbsp;Leafer &nbsp;&nbsp;赞助我们 &nbsp;&nbsp;</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 = true;
397
- if (this.running) this.target.emit(core.RenderEvent.REQUEST);
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
- __onChildEvent(event) {
409
+ addChild(child, parent, eventType) {
407
410
  if (this.config.usePartLayout) {
408
- if (event.type === core.ChildEvent.ADD) {
411
+ if (eventType === core.ChildEvent.ADD) {
409
412
  this.hasAdd = true;
410
- this.__pushChild(event.child);
413
+ this.__pushChild(child);
411
414
  } else {
412
415
  this.hasRemove = true;
413
- this.__updatedList.add(event.parent);
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.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
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
- function updateMatrix(updateList, levelList) {
454
- let layout;
455
- updateList.list.forEach(leaf => {
456
- layout = leaf.__layout;
457
- if (levelList.without(leaf) && !layout.proxyZoom) {
458
- if (layout.matrixChanged) {
459
- updateAllMatrix$1(leaf, true);
460
- levelList.add(leaf);
461
- if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
462
- pushAllParent(leaf, levelList);
463
- } else if (layout.boundsChanged) {
464
- levelList.add(leaf);
465
- if (leaf.isBranch) leaf.__tempNumber = 0;
466
- pushAllParent(leaf, levelList);
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
- function updateBounds(boundsList) {
473
- let list, branch, children;
474
- boundsList.sort(true);
475
- boundsList.levels.forEach(level => {
476
- list = boundsList.levelMap[level];
477
- for (let i = 0, len = list.length; i < len; i++) {
478
- branch = list[i];
479
- if (branch.isBranch && branch.__tempNumber) {
480
- children = branch.children;
481
- for (let j = 0, jLen = children.length; j < jLen; j++) {
482
- if (!children[j].isBranch) {
483
- updateOneBounds(children[j]);
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
- updateOneBounds(branch);
499
+ index++;
488
500
  }
489
- });
490
- }
501
+ },
502
+ updateChange(updateList) {
503
+ updateList.list.forEach(updateOneChange);
504
+ },
505
+ push: push
506
+ };
491
507
 
492
- function updateChange(updateList) {
493
- updateList.list.forEach(updateOneChange);
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 = true;
401
- if (this.running) this.target.emit(RenderEvent.REQUEST);
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
- __onChildEvent(event) {
413
+ addChild(child, parent, eventType) {
411
414
  if (this.config.usePartLayout) {
412
- if (event.type === ChildEvent.ADD) {
415
+ if (eventType === ChildEvent.ADD) {
413
416
  this.hasAdd = true;
414
- this.__pushChild(event.child);
417
+ this.__pushChild(child);
415
418
  } else {
416
419
  this.hasRemove = true;
417
- this.__updatedList.add(event.parent);
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.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
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
- function updateMatrix(updateList, levelList) {
458
- let layout;
459
- updateList.list.forEach(leaf => {
460
- layout = leaf.__layout;
461
- if (levelList.without(leaf) && !layout.proxyZoom) {
462
- if (layout.matrixChanged) {
463
- updateAllMatrix$1(leaf, true);
464
- levelList.add(leaf);
465
- if (leaf.isBranch) pushAllChildBranch(leaf, levelList);
466
- pushAllParent(leaf, levelList);
467
- } else if (layout.boundsChanged) {
468
- levelList.add(leaf);
469
- if (leaf.isBranch) leaf.__tempNumber = 0;
470
- pushAllParent(leaf, levelList);
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
- function updateBounds(boundsList) {
477
- let list, branch, children;
478
- boundsList.sort(true);
479
- boundsList.levels.forEach(level => {
480
- list = boundsList.levelMap[level];
481
- for (let i = 0, len = list.length; i < len; i++) {
482
- branch = list[i];
483
- if (branch.isBranch && branch.__tempNumber) {
484
- children = branch.children;
485
- for (let j = 0, jLen = children.length; j < jLen; j++) {
486
- if (!children[j].isBranch) {
487
- updateOneBounds(children[j]);
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
- updateOneBounds(branch);
503
+ index++;
492
504
  }
493
- });
494
- }
505
+ },
506
+ updateChange(updateList) {
507
+ updateList.list.forEach(updateOneChange);
508
+ },
509
+ push: push
510
+ };
495
511
 
496
- function updateChange(updateList) {
497
- updateList.list.forEach(updateOneChange);
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 };