Skip to content

Commit d7f2462

Browse files
authored
fix: disable hdr badge if screen doesn't support it (#55)
1 parent bf4f63c commit d7f2462

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/web/src/components/ui/photo-viewer/ProgressiveImage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ export const ProgressiveImage = ({
102102
const showContextMenu = useShowContextMenu()
103103

104104
const isHDRSupported = useMediaQuery('(dynamic-range: high)')
105+
// Only use HDR if the browser supports it and the image is HDR
106+
const shouldUseHDR = isHDR && isHDRSupported
105107

106108
return (
107109
<div
@@ -137,7 +139,7 @@ export const ProgressiveImage = ({
137139
}}
138140
>
139141
{/* LivePhoto 或 HDR 模式使用 DOMImageViewer */}
140-
{isLivePhoto || (isHDR && isHDRSupported) ? (
142+
{isLivePhoto || shouldUseHDR ? (
141143
<DOMImageViewer
142144
ref={domImageViewerRef}
143145
onZoomChange={onDOMTransformed}
@@ -190,7 +192,7 @@ export const ProgressiveImage = ({
190192
/>
191193
)}
192194

193-
{isHDR && highResLoaded && blobSrc && isCurrentImage && !error && (
195+
{shouldUseHDR && highResLoaded && blobSrc && isCurrentImage && !error && (
194196
<HDRBadge />
195197
)}
196198

0 commit comments

Comments
 (0)