perf(gallery): 1.8.3 拖动停靠栏时重排节流(宽度变化 <4px 不重排、合并到一帧)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 40s
用户反馈拖动图库面板很卡。原因是面板宽度的 ResizeObserver 每帧触发 renderGrid:整格 clear + 重建全部卡片、 重新挂事件、重新 paint 缩略图,一张卡就十来个 DOM 节点,几十张就是几百节点/帧。 改动(plugins/gallery/main.js + styles.css): - measure():宽度变化不足 4px 不重排;重排用 requestAnimationFrame 合并,一帧最多一次 - 缩略图 img 加 decoding=async(解码移出主线程,减少拖动时的掉帧) - .iwb-history-item 加 contain: layout style(把布局/样式计算限制在卡片内部) 试过「复用 DOM 节点(缓存卡片,重排只移动不重建)」但会让 e2e 里的图库面板加载失败,已回退, 先把节流 + contain + async decode 这组低风险优化发出去。
This commit is contained in:
1 parent
89d8f5ddef
commit
bf15030799
4 files changed
+20
-10
No files matched your search
@@ -65,7 +65,7 @@
|
||||
|
||||
/* ---- 图片墙 ---- */
|
||||
.iwb-history-grid { overscroll-behavior: contain; }
|
||||
.iwb-history-embedded .iwb-history-item { position: relative; flex: none; width: 100%; }
|
||||
.iwb-history-embedded .iwb-history-item { position: relative; flex: none; width: 100%; contain: layout style; }
|
||||
.iwb-history-embedded .iwb-history-item img {
|
||||
width: 100%; height: auto; display: block; object-fit: contain; margin: 0 auto;
|
||||
border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer;
|
||||
|
||||
Reference in new issue
Block a user