Repository navigation
fix: adjust view scale ratio when adding new page #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -877,6 +877,8 @@ void DrawBoard::addPage(Page *page) | |
| fileWatcher()->addWather(page->file()); | ||
|
|
||
| setCurrentPage(page); | ||
|
|
||
| page->adjustViewScaleRatio(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High · Imported images appear too small When an image is loaded through a path that creates a blank page before replacing its scene rect with the image bounds, Fit the view after installing the image scene rect, setting the scale from the desired fit instead of retaining or compounding the blank page's scale. Prompt for AI agentsIn `src/frame/ccentralwidget.cpp` at line 881:
**Imported images appear too small**
When an image is loaded through a path that creates a blank page before replacing its scene rect with the image bounds, `addPage()` scales the default screen-sized scene before the image dimensions are installed, and the later `adjustViewScaleRatio()` does not reset that scale; it either compounds the zoom-out or skips fitting when the image scene fits the viewport, leaving the imported image smaller than intended.
Fit the view after installing the image scene rect, setting the scale from the desired fit instead of retaining or compounding the blank page's scale.There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Hidden pages stay undersized When a page is added before its window has been shown or its layout has established nonzero viewport dimensions, Defer fitting until the viewport has valid dimensions, and retry the fit after the page is shown or resized. Prompt for AI agentsIn `src/frame/ccentralwidget.cpp` at line 881:
**Hidden pages stay undersized**
When a page is added before its window has been shown or its layout has established nonzero viewport dimensions, `adjustViewScaleRatio()` reads the not-yet-laid-out viewport dimensions, computes a zero ratio, and passes it to `PageView::scale()`, which clamps the scale to 0.1. The later resize and show handlers do not fit the page again, so the canvas stays at 10% instead of fitting the viewport.
Defer fitting until the viewport has valid dimensions, and retry the fit after the page is shown or resized. |
||
| } | ||
|
|
||
| bool DrawBoard::closePage(const QString &key) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High · Page construction crashes
When a
Pageis constructed with a non-nullDrawBoard*before its context is set,Pageregisters with the board before its context exists, soadjustViewScaleRatio()reachesscene()with no scene and dereferences the null result, crashing construction.Ensure the page has a context and scene before invoking
adjustViewScaleRatio(), or defer the adjustment until they exist.Prompt for AI agents