From 7b6f28877281309fa12367b16d8de36cf7bf4585 Mon Sep 17 00:00:00 2001 From: lzwind Date: Sun, 15 Nov 2026 13:05:31 +0800 Subject: [PATCH] fix: adjust view scale ratio when adding new page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: DrawBoard::addPage(Page*) does not call adjustViewScaleRatio() after setCurrentPage(), leaving canvas at 100% scale which overflows the viewport area 2. Fix: add page->adjustViewScaleRatio() after setCurrentPage(page) to auto-fit canvas to viewport, matching image-loading path 3. Impact: new blank page canvas now fits viewport; image loading path unaffected due to idempotent nature of the call Log: fix canvas displayed too large when creating new blank page Influence: 1. Test creating new blank canvas at different resolutions and DPR 2. Verify image loading canvas display has no regression 3. Verify canvas margins are even and not touching screen edges fix: 修复画板新建空白页时画布显示偏大 1. 根因:DrawBoard::addPage(Page*) 在 setCurrentPage() 后未调用 adjustViewScaleRatio(),画布以 100% 比例显示时溢出 viewport 2. 方案:在 setCurrentPage(page) 后补调 adjustViewScaleRatio(), 使空白页自动适配 viewport 缩放,与加载图片路径行为一致 3. 影响:新建空白页画布将自动适配窗口可视区域;加载图片路径 不受影响(调用幂等,无副作用) Log: 修复画板新建空白页时画布显示尺寸偏大的问题 Influence: 1. 测试不同分辨率和 DPR 下新建空白画板的显示效果 2. 验证加载图片时画布显示无回归 3. 验证画布留白均匀、上下不贴边 PMS: BUG-287301 --- src/frame/ccentralwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/frame/ccentralwidget.cpp b/src/frame/ccentralwidget.cpp index f21cd8be4..1f21d32b8 100644 --- a/src/frame/ccentralwidget.cpp +++ b/src/frame/ccentralwidget.cpp @@ -877,6 +877,8 @@ void DrawBoard::addPage(Page *page) fileWatcher()->addWather(page->file()); setCurrentPage(page); + + page->adjustViewScaleRatio(); } bool DrawBoard::closePage(const QString &key)