Class PointerScrollEvent
A scroll, from a device or from pointer:scroll, passed to pointer_scroll handlers before the app under the pointer gets it.
Super and the wheel changing a window's opacity, with the scroll kept from the app:
lua
wm.input:on("pointer_scroll", function(event)
if not event.modifiers.super then return end
local target = event.pointer:window_under()
if not target then return end
event:prevent_default()
local opacity = target.box.opacity:target() - event.delta.y / 150
target.box.opacity = math.min(1, math.max(0.2, opacity))
end)Properties
event.pointer: Pointerpointer read only
The pointer that scrolled.
event.delta: Pointdelta read only
How far to scroll, in pixels. Positive x is right, positive y is down.
- A wheel notch is 15.
- A touchpad gives 0 on an axis when the fingers lift. Apps end kinetic scrolling on it.
event.source: "wheel" | "finger" | "continuous"source read only
What did the scrolling: a mouse wheel, fingers on a touchpad, or a continuous source such as a trackball.
- A tilted wheel is
"wheel". - For
pointer:scroll, the source it was given.
event.modifiers: Modifiersmodifiers read only
The modifiers on the keyboard of the pointer's seat.
- All false when the seat has no keyboard.
Methods
event:prevent_default() -> nilprevent_default
Keeps the scroll from the app. Later pointer_scroll handlers still run.