Skip to main content

Module scroll_engine

Module scroll_engine 

Source
Expand description

CygnusEd smooth-scroll engine (§11) — pixel-by-pixel, sub-pixel soft scrolling with momentum/acceleration, à la the Amiga editor’s jerkyless feel. The scroll offset is decoupled from row height (renderers paint at a fractional pixel offset + clip), and the whole thing is deterministic under an injected clock (advance(dt)), so snapshots reproduce exactly (FC-7 / P0-5). Reusable by text, console, and the dataframe grid (SCRL-3).

Structs§

SmoothScroll
A 1-D smooth scroll axis. offset is the current (fractional) pixel offset; target is where we’re easing toward; velocity carries momentum after a flick. Advance with advance (injected dt) — never reads wall-clock time.

Functions§

smooth_scroll_area
Smooth-scroll wrapper around an egui::ScrollArea (SCRL-3): render the area at the eased offset(s) carried by the caller’s SmoothScroll state, run the content, then follow egui’s resolved offset so the position glides instead of snapping. Keeps egui’s virtualization, scrollbars and wheel/flick handling untouched — it only low-passes the displayed offset.