leafer-ui 1.4.1 → 1.4.2

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
@@ -73,7 +73,7 @@ LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.htm
73
73
 
74
74
  【Bug/建议】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
75
75
 
76
- 环境:电脑 + window 11 + chrome 131 + leaferjs 1.4.1
76
+ 环境:电脑 + window 11 + chrome 131 + leaferjs 1.4.2
77
77
 
78
78
  复现步骤:请提供详细的复现逻辑及可直接运行的代码,以便更快解决问题。
79
79
  ```
@@ -93,7 +93,7 @@ LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.htm
93
93
 
94
94
  【leaferjs】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
95
95
 
96
- 环境:电脑 + window 11 + chrome 131 + leaferjs 1.4.1
96
+ 环境:电脑 + window 11 + chrome 131 + leaferjs 1.4.2
97
97
 
98
98
  #LeaferJS (点击知乎提问框底部的 # 号,可绑定话题)
99
99
  ```
package/dist/web.js CHANGED
@@ -3638,7 +3638,12 @@ var LeaferUI = (function (exports) {
3638
3638
  return R.map[key];
3639
3639
  },
3640
3640
  remove(key) {
3641
- delete R.map[key];
3641
+ const r = R.map[key];
3642
+ if (r) {
3643
+ if (r.destroy)
3644
+ r.destroy();
3645
+ delete R.map[key];
3646
+ }
3642
3647
  },
3643
3648
  loadImage(key, format) {
3644
3649
  return new Promise((resolve, reject) => {
@@ -3664,6 +3669,7 @@ var LeaferUI = (function (exports) {
3664
3669
  const R = Resource;
3665
3670
 
3666
3671
  const ImageManager = {
3672
+ maxRecycled: 100,
3667
3673
  recycledList: [],
3668
3674
  patternTasker: new TaskProcessor(),
3669
3675
  get(config) {
@@ -3680,13 +3686,8 @@ var LeaferUI = (function (exports) {
3680
3686
  },
3681
3687
  clearRecycled() {
3682
3688
  const list = I$1.recycledList;
3683
- if (list.length > 100) {
3684
- list.forEach(image => {
3685
- if (!image.use && image.url) {
3686
- Resource.remove(image.url);
3687
- image.destroy();
3688
- }
3689
- });
3689
+ if (list.length > I$1.maxRecycled) {
3690
+ list.forEach(image => (!image.use && image.url) && Resource.remove(image.url));
3690
3691
  list.length = 0;
3691
3692
  }
3692
3693
  },
@@ -6054,7 +6055,7 @@ var LeaferUI = (function (exports) {
6054
6055
  }
6055
6056
  }
6056
6057
 
6057
- const version = "1.4.1";
6058
+ const version = "1.4.2";
6058
6059
 
6059
6060
  const debug$5 = Debug.get('LeaferCanvas');
6060
6061
  class LeaferCanvas extends LeaferCanvasBase {