Skip to content

Class PointerMoveEvent ​

A pointer movement, from a device or from pointer:move, passed to pointer_move handlers before the app under the pointer sees it.

A glow in the top-left corner while the pointer is near it, the start of a hot corner:

lua
local corner_glow = Drawable.rect({ left = 0, top = 0, width = 48, height = 48, radius = 24, fill = "#ffffff00" })
wm.drawables:add(corner_glow)
local was_near = false

wm.input:on("pointer_move", function(event)
	local near = event.position.x < 48 and event.position.y < 48
	if near == was_near then return end
	was_near = near
	corner_glow.fill = Anim.tween(near and "#ffffff40" or "#ffffff00", 150)
end)

Properties ​

event.pointer: Pointerpointer read only ​

The pointer that moved.

event.position: Pointposition read only ​

Where the pointer is moving to, in global coordinates. pointer:position() still gives the old position while handlers run.

  • Under an active pointer lock it is the old position, since the pointer won't move.
  • Under an active confinement it is already clamped to the area.

event.output_position: Point?output_position read only ​

For a device with absolute positions, such as a tablet or the window Hazel runs in when nested: the position within the output it is mapped to.

event.delta: Pointdelta read only ​

How far the pointer moved since the last event, after pointer acceleration.

  • For pointer:move, the distance from the old position to the new one.
  • For an absolute device, the distance between its last two positions.

event.delta_unaccel: Pointdelta_unaccel read only ​

The same movement before acceleration, as games want it.

  • Same as delta for pointer:move and absolute devices.

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 pointer where it was. No app gets the motion. Later pointer_move handlers still run.