@@ -8,7 +8,6 @@ import type { FC } from "react"
8
8
import { Fragment , useCallback , useEffect , useRef , useState } from "react"
9
9
import { Blurhash } from "react-blurhash"
10
10
import { useTranslation } from "react-i18next"
11
- import { TransformComponent , TransformWrapper } from "react-zoom-pan-pinch"
12
11
import { Keyboard , Mousewheel } from "swiper/modules"
13
12
import type { SwiperRef } from "swiper/react"
14
13
import { Swiper , SwiperSlide } from "swiper/react"
@@ -323,63 +322,48 @@ const FallbackableImage: FC<
323
322
324
323
const { height : windowHeight , width : windowWidth } = useWindowSize ( )
325
324
326
- const wrapperClass = cn ( "relative !max-h-full" , width <= height && "!h-full" )
327
- const wrapperStyle = {
328
- // px-20 pb-8 pt-10
329
- width :
330
- width && height && width > height
331
- ? `${ Math . min ( ( windowHeight - 32 - 40 ) * ( width / height ) , width ) } px`
332
- : undefined ,
333
- maxWidth : width > height ? `${ windowWidth - 80 - 80 - 400 } px` : undefined ,
334
- }
335
-
336
325
return (
337
- < div
338
- className = { cn ( "center flex size-full flex-col" , containerClassName ) }
339
- onClick = { stopPropagation }
340
- >
326
+ < div className = { cn ( "center flex size-full flex-col" , containerClassName ) } >
341
327
{ ! isAllError && (
342
- < TransformWrapper wheel = { { step : 1 } } >
343
- < TransformComponent
344
- wrapperClass = { wrapperClass }
345
- wrapperStyle = { wrapperStyle }
346
- contentClass = { wrapperClass }
347
- contentStyle = { wrapperStyle }
328
+ < div
329
+ className = { cn ( "relative max-h-full" , width <= height && "h-full" ) }
330
+ style = { {
331
+ // px-20 pb-8 pt-10
332
+ width :
333
+ width && height && width > height
334
+ ? `${ Math . min ( ( windowHeight - 32 - 40 ) * ( width / height ) , width ) } px`
335
+ : undefined ,
336
+ maxWidth : width > height ? `${ windowWidth - 80 - 80 - 400 } px` : undefined ,
337
+ } }
338
+ >
339
+ < img
340
+ data-blurhash = { blurhash }
341
+ src = { currentSrc }
342
+ onLoad = { ( ) => setIsLoading ( false ) }
343
+ onError = { handleError }
344
+ height = { props . height }
345
+ width = { props . width }
346
+ { ...props }
347
+ className = { cn (
348
+ "transition-opacity duration-700" ,
349
+ isLoading ? "opacity-0" : "opacity-100" ,
350
+ props . className ,
351
+ ) }
352
+ style = { props . style }
353
+ />
354
+ < div
355
+ className = { cn (
356
+ "center absolute inset-0 size-full transition-opacity duration-700" ,
357
+ isLoading ? "opacity-100" : "opacity-0" ,
358
+ ) }
348
359
>
349
- < img
350
- data-blurhash = { blurhash }
351
- src = { currentSrc }
352
- onLoad = { ( ) => setIsLoading ( false ) }
353
- onError = { handleError }
354
- height = { props . height }
355
- width = { props . width }
356
- { ...props }
357
- className = { cn (
358
- "transition-opacity duration-700" ,
359
- isLoading ? "opacity-0" : "opacity-100" ,
360
- props . className ,
361
- ) }
362
- style = { props . style }
363
- />
364
- < div
365
- className = { cn (
366
- "center absolute inset-0 size-full transition-opacity duration-700" ,
367
- isLoading ? "opacity-100" : "opacity-0" ,
368
- ) }
369
- >
370
- { blurhash ? (
371
- < Blurhash
372
- hash = { blurhash }
373
- resolutionX = { 32 }
374
- resolutionY = { 32 }
375
- className = "!size-full"
376
- />
377
- ) : (
378
- < i className = "i-mgc-loading-3-cute-re size-8 animate-spin text-white/80" />
379
- ) }
380
- </ div >
381
- </ TransformComponent >
382
- </ TransformWrapper >
360
+ { blurhash ? (
361
+ < Blurhash hash = { blurhash } resolutionX = { 32 } resolutionY = { 32 } className = "!size-full" />
362
+ ) : (
363
+ < i className = "i-mgc-loading-3-cute-re size-8 animate-spin text-white/80" />
364
+ ) }
365
+ </ div >
366
+ </ div >
383
367
) }
384
368
{ isAllError && (
385
369
< div
0 commit comments