Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Update ImageLightbox.tsx

Abi Raja8952a4cbfd0a
diff --git a/frontend/src/components/ImageLightbox.tsx b/frontend/src/components/ImageLightbox.tsx
index 53b86262..88cc3e6f 100644
--- a/frontend/src/components/ImageLightbox.tsx
+++ b/frontend/src/components/ImageLightbox.tsx
@@ -131,6 +131,12 @@ function ImageLightbox({ image, onClose }: ImageLightboxProps) {
}
}, []);
+ const handleWheel = useCallback((e: React.WheelEvent) => {
+ if (!viewportRef.current) return;
+ viewportRef.current.scrollTop += e.deltaY;
+ viewportRef.current.scrollLeft += e.deltaX;
+ }, []);
+
const handleViewportClick = useCallback(() => {
if (dragRef.current.didDrag) {
dragRef.current.didDrag = false;
@@ -160,6 +166,7 @@ function ImageLightbox({ image, onClose }: ImageLightboxProps) {
onMouseMove={handleMouseMove}
onMouseUp={handleMouseUp}
onMouseLeave={handleMouseUp}
+ onWheel={handleWheel}
onClick={handleViewportClick}
>
<div className="flex min-h-full min-w-full items-center justify-center p-8">