diff --git a/src/app/components/image-viewer/ImageViewer.tsx b/src/app/components/image-viewer/ImageViewer.tsx index 39761e784..4429b0d40 100644 --- a/src/app/components/image-viewer/ImageViewer.tsx +++ b/src/app/components/image-viewer/ImageViewer.tsx @@ -86,7 +86,12 @@ export const ImageViewer = as<'div', ImageViewerProps>( className={css.ImageViewerImg} style={{ cursor, - transform: `scale(${zoom}) translate(${pan.translateX}px, ${pan.translateY}px)`, + // translate runs inside scale(), so divide by zoom to make a dragged + // pixel move the image one screen pixel (1:1 with the cursor) rather + // than `zoom` pixels. + transform: `scale(${zoom}) translate(${pan.translateX / zoom}px, ${ + pan.translateY / zoom + }px)`, }} src={src} alt={alt}