style(清理代码): 保持代码风格
build.yaml / build (push) Successful in 36s

This commit is contained in:
xiaoqidun committed 2026-09-08 10:30:27 +08:00
1 parent 425c01dde5
commit c9ccb77306
2 files changed
+8 -10

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@
<button id="zoomInButton" class="icon-button" type="button" title="放大" disabled>+</button>
<button id="fitButton" class="button" type="button" data-short="宽" aria-label="适宽" disabled>适宽</button>
<button id="fitHeightButton" class="button" type="button" data-short="高" aria-label="适高" disabled>适高</button>
<button id="continuousButton" class="button" type="button" data-short="连" title="无间距连续显示" aria-label="无间距连续显示" aria-pressed="false" disabled>连续</button>
<button id="continuousButton" class="button" type="button" data-short="连" title="无距连续显示" aria-label="无距连续显示" aria-pressed="false" disabled>连续</button>
<button id="annotationButton" class="button" type="button" data-short="注" title="渲染注解" aria-label="渲染注解" aria-pressed="true">注解</button>
</div>
<div class="tool-group">
+7 -9
View File
@@ -1424,7 +1424,6 @@ function pageShellFromView() {
const x = rect.left + rect.width / 2;
if (state.continuous) {
if (el.viewerPanel.scrollTop + el.viewerPanel.clientHeight >= el.viewerPanel.scrollHeight - 1) {
// 末尾无法顶对齐时保留完整可见的当前页
const shell = pageShell(state.pageIndex);
const bounds = shell?.getBoundingClientRect();
return bounds && bounds.top >= rect.top - 1 && bounds.bottom <= rect.bottom + 1
@@ -2139,18 +2138,17 @@ function fitHeight(updateStatus = true) {
const contentWidth = state.doc.pages.reduce((max, item) => Math.max(max, item.width), 0) * MM_TO_PX;
const contentHeight = state.doc.pages.reduce((total, item) => total + item.height, 0) * MM_TO_PX;
const scale = Math.min(availableWidth / width, availableHeight / height);
const vertical = scale > availableHeight / contentHeight;
const horizontal = scale > availableWidth / contentWidth;
if (vertical || horizontal) {
const needsVerticalScrollbar = scale > availableHeight / contentHeight;
const needsHorizontalScrollbar = scale > availableWidth / contentWidth;
if (needsVerticalScrollbar || needsHorizontalScrollbar) {
const scrollbar = scrollbarWidth();
availableWidth = Math.max(1, availableWidth - (vertical ? scrollbar : 0));
availableHeight = Math.max(1, availableHeight - (horizontal ? scrollbar : 0));
// 一侧滚动条占用空间后,另一侧也可能需要滚动条
availableWidth = Math.max(1, availableWidth - (needsVerticalScrollbar ? scrollbar : 0));
availableHeight = Math.max(1, availableHeight - (needsHorizontalScrollbar ? scrollbar : 0));
const nextScale = Math.min(availableWidth / width, availableHeight / height);
if (!vertical && nextScale > availableHeight / contentHeight) {
if (!needsVerticalScrollbar && nextScale > availableHeight / contentHeight) {
availableWidth = Math.max(1, availableWidth - scrollbar);
}
if (!horizontal && nextScale > availableWidth / contentWidth) {
if (!needsHorizontalScrollbar && nextScale > availableWidth / contentWidth) {
availableHeight = Math.max(1, availableHeight - scrollbar);
}
}