fix: sprite thumbnail rendering — use height-based scaling and top-align#22
Closed
patrick3399 wants to merge 1 commit intomainfrom
Closed
fix: sprite thumbnail rendering — use height-based scaling and top-align#22patrick3399 wants to merge 1 commit intomainfrom
patrick3399 wants to merge 1 commit intomainfrom
Conversation
Thumbnails in ThumbnailStrip (Reader) and PreviewGrid (gallery detail)
were split across cells or obscured by black areas due to incorrect
CSS sprite scaling.
Root cause:
- backgroundSize used 'auto {computed}px' which produced a height
larger than the container
- backgroundPosition used 'center' for vertical alignment, causing
the sprite to be vertically offset and show adjacent cells or
black padding
Fix:
- Use 'backgroundSize: auto 100%' so sprite height exactly matches
the container
- Use 'backgroundPosition: Xpx 0px' (top-aligned) to prevent
vertical centering misalignment
- Recalculate X offset using height-based scale factor since the
browser scales proportionally from height with auto 100%
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.
Problem
Thumbnails in the Reader bottom strip (ThumbnailStrip) and Gallery detail preview grid (PreviewGrid) were either split (showing adjacent sprite cells) or obscured by black areas.
Root Cause
E-Hentai uses CSS sprite sheets for preview thumbnails. The frontend rendering had two bugs:
Fix
backgroundSize: auto 100%so sprite height exactly matches the containerbackgroundPosition: Xpx 0px(top-aligned) to prevent vertical centering misalignmentauto 100%makes the browser scale proportionally from height)Files Changed
pwa/src/components/Reader/index.tsx—ThumbnailStripcomponentpwa/src/app/browse/[gid]/[token]/page.tsx—PreviewGridcomponent