diff --git a/src/workspaces/officerdev/src/apps/FileViewer/renderers/ImageRenderer.tsx b/src/workspaces/officerdev/src/apps/FileViewer/renderers/ImageRenderer.tsx index 951c7d9d..88724e8e 100644 --- a/src/workspaces/officerdev/src/apps/FileViewer/renderers/ImageRenderer.tsx +++ b/src/workspaces/officerdev/src/apps/FileViewer/renderers/ImageRenderer.tsx @@ -77,6 +77,27 @@ export const ImageRenderer = ({ src, fileName }: ImageRendererProps) => { if (zoom <= 1) setOffset({ x: 0, y: 0 }); }, [zoom]); + /* + A NEW FILE IS A NEW LOAD, and everything about the last one goes. + + `loaded` was set once and never cleared, which did not matter while a viewer showed one file for its + whole life. With a carousel it is the bug you see: the flag stays true, the opacity gate stays open, + and the browser goes on painting the PREVIOUS photograph until the next one has decoded. Stepping + through a folder looked like the image lagged a beat behind the strip — the strip was right and the + picture was stale. + + Zoom, rotation and pan reset with it. They are a view of one image, and carrying 3x and 90 degrees + onto the next photograph means arriving somewhere nobody asked to be, in the corner of a picture + they have not seen yet. + */ + useEffect(() => { + setLoaded(false); + setError(false); + setZoom(1); + setRotation(0); + setOffset({ x: 0, y: 0 }); + }, [src]); + if (error) { return (