reader: fix skewed sidebar page thumbnails - #12
Open
DenizSAHIN570 wants to merge 1 commit into
Open
DenizSAHIN570 wants to merge 1 commit into
DenizSAHIN570 wants to merge 1 commit into
Conversation
previewForPage() positioned elements against a hardcoded 166x247 content box, but never offset by the page's actual margins/header height - so every element rendered as if x=0,y=0 meant the page's top-left corner instead of the content area's top-left corner (which is where position:0,0 actually is, per PageRenderer). Elements ended up compressed and flush against the top-left edge instead of properly inset. Now computes real page dimensions via getPageDimensions() (mirrors PageRenderer) and offsets each element by margins.left / (margins.top + headerHeight), matching how the page actually renders. Also fixed the thumbnail box's aspect ratio to track the page's real size/orientation instead of a hardcoded 210/297, so non-A4 pages don't skew either. Fixes uurtech#10
DenizSAHIN570
force-pushed
the
fix/sidebar-thumbnail-aspect
branch
from
September 14, 2026 20:07
cebf404 to
d00c719
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10.
previewForPage()inSidebar.tsxpositioned elements against a hardcoded 166x247 box but never offset by the page's actual margins/header height, sox=0,y=0rendered at the page's top-left corner instead of the content area's top-left corner — which is what position 0,0 actually means (see howPageRendererinsets its content div bymargins.left/margins.top + headerHeight). Elements ended up compressed and flush against the top-left edge instead of properly inset.Now computes real page dimensions via
getPageDimensions()(same helperPageRendereruses) and applies the same margin/header offset, so the thumbnail matches what the page actually renders. Also made the thumbnail box's aspect ratio track the page's real size/orientation instead of a hardcoded 210/297, so non-A4 pages don't skew either.Note: these thumbnails are an abstract wireframe (generic colored bars per element type), not a real scaled render of the page — this PR only fixes their positioning/aspect within that existing design.
Tested against
docs/examples/article.jdf(the doc from the linked issue's screenshot) — confirmed the stray disconnected line is gone and content is properly inset now.