diff --git a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx index 20e3c8ca4..dcdbc4b33 100644 --- a/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx +++ b/ui/v2.5/src/hooks/Lightbox/Lightbox.tsx @@ -855,6 +855,8 @@ export const LightboxComponent: React.FC = ({ {i >= currentIndex - 1 && i <= currentIndex + 1 ? ( = ({ src, + width, + height, displayMode, scaleUp, scrollMode, @@ -94,8 +98,6 @@ export const LightboxImage: React.FC = ({ const [moving, setMoving] = useState(false); const [positionX, setPositionX] = useState(0); const [positionY, setPositionY] = useState(0); - const [width, setWidth] = useState(0); - const [height, setHeight] = useState(0); const [boxWidth, setBoxWidth] = useState(0); const [boxHeight, setBoxHeight] = useState(0); @@ -135,24 +137,6 @@ export const LightboxImage: React.FC = ({ }, 250); }, [container]); - useEffect(() => { - let mounted = true; - const img = new Image(); - function onLoad() { - if (mounted) { - setWidth(img.width); - setHeight(img.height); - } - } - - img.onload = onLoad; - img.src = src; - - return () => { - mounted = false; - }; - }, [src]); - const minMaxY = useCallback( (appliedZoom: number) => { let minY, maxY: number; @@ -528,15 +512,6 @@ export const LightboxImage: React.FC = ({ } const ImageView = isVideo ? "video" : "img"; - const customStyle = isVideo - ? { - touchAction: "none", - display: "flex", - margin: "auto", - width: "100%", - "max-height": "90vh", - } - : { touchAction: "none" }; return (
= ({ src={src} alt="" draggable={false} - style={customStyle} + style={{ touchAction: "none" }} onWheel={current ? (e) => onImageScroll(e) : undefined} onMouseDown={onImageMouseDown} onMouseUp={onImageMouseUp}