Skip to main content

Function: wheelAction()

wheelAction(event, settings, modifier): WheelAction

Defined in: src/lib/utils/navigation/index.ts:54

Decide what a wheel movement does:

  • With Ctrl held, or a trackpad pinch (which browsers report as Ctrl + wheel): zoom, if pinch zoom is on (or, where Ctrl is the zoom key, if modifier zoom is on).
  • With Cmd held (Apple devices): zoom, if modifier zoom is on.
  • Otherwise: pan, if scroll panning is on.

Parameters​

event​

Pick<WheelEvent, "deltaX" | "deltaY" | "deltaMode" | "ctrlKey" | "metaKey">

settings​

NavigationSettings

modifier​

"Cmd" | "Ctrl"

Returns​

WheelAction

Example​

wheelAction({ deltaX: 0, deltaY: 10, deltaMode: 0, ctrlKey: false, metaKey: false }, settings, "Cmd");
// { kind: "pan", dx: -0, dy: -10 }