refactor: remove thumbnail padding constants for cleaner calculations

- Eliminated `THUMBNAIL_PADDING` constants to simplify thumbnail height calculations in the viewer.
- Updated `computeViewerImageFrame` to directly use `THUMBNAIL_SIZE` for determining thumbnail height based on device type.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-11-30 23:23:52 +08:00
parent 5763ec8dba
commit 9618a68b9b

View File

@@ -9,11 +9,6 @@ const THUMBNAIL_SIZE = {
desktop: 64,
} as const
const THUMBNAIL_PADDING = {
mobile: 12,
desktop: 16,
} as const
export const escapeAttributeValue = (value: string) => {
if (window.CSS?.escape) {
return window.CSS.escape(value)
@@ -52,9 +47,7 @@ export const computeViewerImageFrame = (
): AnimationFrameRect => {
const baseFontSize = getRootFontSize()
const exifWidth = isMobile ? 0 : DESKTOP_EXIF_PANEL_WIDTH_REM * baseFontSize
const thumbnailHeight = isMobile
? THUMBNAIL_SIZE.mobile + THUMBNAIL_PADDING.mobile * 2
: THUMBNAIL_SIZE.desktop + THUMBNAIL_PADDING.desktop * 2
const thumbnailHeight = isMobile ? THUMBNAIL_SIZE.mobile : THUMBNAIL_SIZE.desktop
const viewportWidth = viewportRect?.width ?? window.innerWidth
const viewportHeight = viewportRect?.height ?? window.innerHeight