feat(阅读编辑): 统一单双页缩略图间距
build.yaml / build (push) Successful in 45s

This commit is contained in:
xiaoqidun committed 2026-10-19 18:12:12 +08:00
1 parent 5fd3854af8
commit ea55e997ee
2 files changed
+10 -8

No files matched your search

+4 -3
View File
@@ -2563,8 +2563,9 @@ button.outline-link:hover {
}
.page-list {
--thumb-gap: 12px;
display: grid;
gap: 12px;
gap: var(--thumb-gap);
}
.virtual-pages {
@@ -3132,8 +3133,8 @@ button.outline-link:hover {
height: auto;
}
.grouped-pages .page-list-item.drop-before::before { left: -5px; right: auto; }
.grouped-pages .page-list-item.drop-after::after { right: -5px; left: auto; }
.grouped-pages .page-list-item.drop-before::before { left: calc(-1px - var(--thumb-gap) / 2); right: auto; }
.grouped-pages .page-list-item.drop-after::after { right: calc(-1px - var(--thumb-gap) / 2); left: auto; }
.edit-object.erasing {
background: var(--accent-soft);
+6 -5
View File
@@ -10874,12 +10874,13 @@ function layoutThumbnails() {
view.rotation = state.rotation;
view.layout = state.pageLayout;
view.host.classList.toggle("grouped-pages", state.pageLayout > 1);
const gap = Number.parseFloat(getComputedStyle(view.host).columnGap) || 0;
const offsets = new Float64Array(state.doc.pages.length + 1);
view.heights = new Float64Array(state.doc.pages.length);
view.lefts = state.pageLayout > 1 ? new Float64Array(state.doc.pages.length) : null;
view.scales = state.pageLayout > 1 ? new Float64Array(state.doc.pages.length) : null;
view.columns = state.pageLayout > 1 ? state.pageLayout : 0;
view.itemWidth = state.pageLayout > 1 ? Math.max(1, (width - 8) / 2) : width;
view.itemWidth = state.pageLayout > 1 ? Math.max(1, (width - gap) / 2) : width;
let top = 0;
for (let start = 0; start < state.doc.pages.length; start += state.pageLayout) {
if (state.pageLayout === 1) {
@@ -10887,7 +10888,7 @@ function layoutThumbnails() {
const ratio = size.width > 0 && size.height > 0 ? size.height / size.width : 1 / 0.707;
view.heights[start] = Math.max(1, width - 20) * ratio + 70;
offsets[start] = top;
top += view.heights[start] + 12;
top += view.heights[start] + gap;
continue;
}
const group = pageGroupSize(start), scale = Math.max(1, view.itemWidth - 20) / Math.max(...group.widths);
@@ -10897,14 +10898,14 @@ function layoutThumbnails() {
if (index >= state.doc.pages.length) break;
offsets[index] = top;
view.heights[index] = height;
view.lefts[index] = column * (view.itemWidth + 8);
view.lefts[index] = column * (view.itemWidth + gap);
view.scales[index] = scale;
}
top += height + 20;
top += height + gap;
}
offsets[state.doc.pages.length] = top;
view.offsets = offsets;
view.gap = 12;
view.gap = gap;
view.total = Math.ceil(offsets.at(-1));
for (const [index, button] of view.nodes) {
layoutThumbnail(button, state.doc.pages[index]);