file
mouse.jsConstants
CHROME_UA
- Flag indicating Chrome UserAgent.
Functions
chrome_movement_factor
()
- Determine factor for Chrome to convert movementX to CSS px (based on event history)
event_movement
(
event, shift_swaps)
-
Determine
movementX,movementY
in CSS pixels, independent of browser quirks. wheel_delta
(
event, shift_swaps)
-
Determine mouse wheel deltas in bare units, independent of zoom or DPI.
This returns an object
{deltaX,deltaY}
with negative values pointing LEFT/UP and positive values RIGHT/DOWN respectively. For zoom step interpretation, the x/y pixel values should be reduced viaMath.sign()
. For scales the pixel values might feel more natural, because browsers sometimes increase the number of events with increasing wheel distance, in other cases values are accumulated so fewer events with larger deltas are sent instead. The members{x,y}
approximate the wheel delta in pixels. zmove_last
()
- Peek at the last pointer coordination event.
zmove_add
(
hook)
- Add hook to be called once the mouse position or stacking state changes, returns deleter.
zmove_trigger
(
ev)
- Trigger zmove hooks, this is useful to get debounced notifications for pointer movements, including 0-distance moves after significant UI changes.