Skip to content

Commit 0e7a61d

Browse files
committed
Revert "feat: image zoom"
This reverts commit 4b5b603.
1 parent 4b5b603 commit 0e7a61d

File tree

3 files changed

+43
-75
lines changed

3 files changed

+43
-75
lines changed

apps/renderer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"react-selecto": "^1.26.3",
8686
"react-shadow": "20.5.0",
8787
"react-virtuoso": "4.12.0",
88-
"react-zoom-pan-pinch": "^3.6.1",
8988
"rehype-infer-description-meta": "2.0.0",
9089
"rehype-parse": "9.0.1",
9190
"rehype-sanitize": "6.0.0",

apps/renderer/src/components/ui/media/preview-media.tsx

Lines changed: 39 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { FC } from "react"
88
import { Fragment, useCallback, useEffect, useRef, useState } from "react"
99
import { Blurhash } from "react-blurhash"
1010
import { useTranslation } from "react-i18next"
11-
import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch"
1211
import { Keyboard, Mousewheel } from "swiper/modules"
1312
import type { SwiperRef } from "swiper/react"
1413
import { Swiper, SwiperSlide } from "swiper/react"
@@ -323,63 +322,48 @@ const FallbackableImage: FC<
323322

324323
const { height: windowHeight, width: windowWidth } = useWindowSize()
325324

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-
336325
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)}>
341327
{!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+
)}
348359
>
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>
383367
)}
384368
{isAllError && (
385369
<div

pnpm-lock.yaml

Lines changed: 4 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)