fix(gallery): 1.8.2 列宽按「真正滚动容器」的可用宽度算,最右一列不再被裁
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 1m34s

现象:图库 4 列排布时最右一列被窗口裁掉(用户截图)。
原因:renderGrid 用 wrap.clientWidth(面板全宽)当可用宽度,而实际滚动容器右侧还有滚动条与内边距,
列宽按全宽均分后总宽超出可视区,最右一列被裁。

改动(plugins/gallery/main.js):
- 新增 usableW():沿 scrollerOf() 找到真正滚动的容器,取其 clientWidth 减去左右 padding 与 4px 余量
- renderGrid / measure 都改用 usableW(),并且每次都采用实测值(不再因为差值 ≤1 而沿旧值)
- colW 改为 floor,避免四舍五入后 n 列总宽超出容器
This commit is contained in:
qiqi committed 2026-11-28 01:44:12 +08:00
1 parent 6c598e3898
commit 89d8f5ddef
3 files changed
+24 -9

No files matched your search

+3 -3
View File
@@ -33,10 +33,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.8.1",
"version": "1.8.2",
"files": {
"manifest.json": "8e1235f0f0d89d81c9aafe8e4eac4a4dc3521c1b583c845b15595ddeecc7c0c2",
"main.js": "6dd3bf43dce74236d4904c4e33639772ef03bd4cd80d6e5a4532ff7ca7ed085a",
"manifest.json": "d54679889ab43e54408f6ff5731a557a9816ad5872ea86a341f98f3dfec30eb3",
"main.js": "eb178baa9d1c8d3148e93e38513bd35754d720e8af8f02c53c041d7e1322dac3",
"styles.css": "14d374b5d0e1461cb1ca2b125865e9c27df7c3bd79c11caa0afc52152c7d0aef"
}
},