pub fn shift_wheel_remap(
event: &WidgetEvent,
ctx: &EventContext<'_>,
) -> Option<WidgetEvent>Expand description
Rewrite a Shift+wheel notch into a horizontal one, or decline.
A vertical-only wheel held with Shift scrolls a horizontally-scrollable
surface sideways — the convention TabBar established in this crate and
every desktop toolkit shares. The transform is a delta rewrite, which
handle_scroll_event cannot express because it reads the delta off the
event; a surface that wants it builds the rewritten event here and hands
that to the shared handler from its ScrollableBehavior::before arm, so
the arithmetic is still written once.
Declines — returning None, meaning “no remap, treat this event as it
came” — for anything but a wheel-family [WidgetEvent::Scroll] held with
Shift whose horizontal component is zero. Two of those clauses carry the
rule rather than the example:
- A delta with a real horizontal component is a trackpad’s own two-axis stream, and rewriting it would throw the axis the user actually moved.
- A [
ScrollSource::TouchPan] is never remapped. A finger has no Shift key, so the modifier could only arrive from a keyboard held during a pan, and turning that pan sideways is not what the hand asked for.