Skip to content

Commit 5ee03f0

Browse files
committed
Keep the minimap up for the whole pan
Starting a pan showed the minimap with the same 2.2 s fade-out timer as a wheel step, so a longer pan lost the minimap halfway through. While a pan is active the minimap is held like when the pointer is on it, and the fade-out timer starts when the pan ends.
1 parent 1360c1e commit 5ee03f0

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Architecture v1 (`architecture-v1`), not yet released.
5050

5151
### Fixed
5252

53+
- The minimap stays visible for as long as you pan the canvas, and fades out only after the pan
54+
ends; it used to disappear two seconds into a longer pan.
5355
- Pressing a container's or text block's menu button again closes its menu instead of reopening it.
5456
- The JSON editor and workflow windows fade their glass in and out again; the glass stayed
5557
transparent for the whole fade and then appeared at once.

‎src/App.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3115,6 +3115,17 @@ function App({ useDocument, useSettings, retained }: AppProps) {
31153115
}
31163116
};
31173117

3118+
// A pan keeps the minimap up for as long as it lasts, like pointing at it; the fade-out timer
3119+
// starts when the pan ends.
3120+
const panning = interactionSnapshot.activeInteraction?.kind === "pan";
3121+
const minimapHold = useStableCallbacks({ holdMinimap });
3122+
const wasPanning = useRef(false);
3123+
useEffect(() => {
3124+
if (panning === wasPanning.current) return;
3125+
wasPanning.current = panning;
3126+
minimapHold.holdMinimap(panning);
3127+
}, [minimapHold, panning]);
3128+
31183129
const undo = () => {
31193130
retained.runtime.callbacks.undo();
31203131
rename.end();

0 commit comments

Comments
 (0)