SIGN IN SIGN UP

plot: Keep tooltip in sync while the chart scrolls under the cursor (#2588)

## Description

With a chart tooltip visible, scrolling the page moved the plot under a
stationary cursor, but the cached cursor position (recorded only on
`MouseMoveEvent`) never updated: the tooltip rode along with the chart,
drifted over surrounding content, and never cleared.

Changes in the `IntoPlot` derive:

- Re-derive the cursor state every frame in the generated `paint`, where
`hitbox.is_hovered` is fresh (the window recomputes its hit test between
prepaint and paint). When visibility flips, schedule one corrective
frame via `request_animation_frame()` — `refresh()` is a no-op while
drawing.
- `prepaint` now derives the tooltip position from the live
`window.mouse_position()` and the frame's bounds instead of the cached
point, so the crosshair tracks the data under the cursor while scrolling
without jitter; a `bounds.contains` guard hides the tooltip the same
frame the plot moves out from under the cursor.

Verified in the story gallery chart page: hover/follow/leave regression,
scroll-under-cursor (no drift, no jitter, clears when the chart scrolls
away), and occluding-overlay behavior from #2581.

> This PR was implemented with AI (reviewed and manually verified).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
F
Floyd Wang committed
3f9e655e8668fff37df41c541e0d9f3ec992fa7d
Parent: 87103d0
Committed by GitHub <noreply@github.com> on 7/23/2026, 3:11:58 AM