mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-14 01:53:11 +00:00
Building on the centring of #3547, a step to a match could still leave the match off screen after zooming, now and then: - A zoom pending in the same frame (Ctrl+wheel, pinch, a zoom button or key) took the layout's anchor branch, so the step's `goto` waited for the next frame and its page-top offset (60 pt from the top, scaled by the zoom) undid the centring. At 600% that is below the window. - egui eases a Ctrl-wheel notch over about a quarter of a second. Every frame of that set a new zoom anchor at the pointer, which moved the match just stepped to away from the middle again. A step whose match centre is known now scrolls by that point alone and drops a pending zoom anchor. Until the first frame without a zoom gesture after the step is laid out, any zoom (`zoom_at`, so the wheel, pinch, buttons and keys) and a changing fit zoom anchor on the match at the window's centre. Another jump lets go of it. Match centres that are not finite (a hostile page's glyphs spanning -inf..inf) fall back to the page jump instead of a NaN scroll target. Tests: search_position.rs steps through needles on pages larger and smaller than the window at 10-3200%, in every page display, from the Search panel, in a fixed pseudo-random mix of zooms and steps (some in the same frame) and during real eased Ctrl-wheel zooms. With #3547 alone three of them fail; on main all four original ones do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>