Module Brr_note_kit.Mouse
User mouse.
Excepts for mouse ups, mouse events are only reported whenever the mouse is over the specified target.
By default coordinates are in target normalized coordinates with (0, 0) corresponding to the bottom left corner and (1,1) to the top right corner.
Mouse events
type 'a events
The type for gathering mouse events on a given target and using
'a
to represent points.
val on_target : ?capture:bool -> ?propagate:bool -> ?default:bool -> ?normalize:bool -> (float -> float -> 'a) -> Brr.Ev.target -> 'a events
on_target pt t
is mouse events for targett
usingpt
to construct points. Ifnormalize
istrue
(default) coordinates are reported in target normalized coordinates (see above), iffalse
they are reported in pixels with the origin at the top-left of the element. The other parameters are those fromBrr_note.Evr.on_target
.
val on_el : ?capture:bool -> ?propagate:bool -> ?default:bool -> ?normalize:bool -> (float -> float -> 'a) -> Brr.El.t -> 'a events
on_el
is likeon_target
but for an element. Note thatdestroy
automatically gets called with the result whenever the element is removed from the HTML DOM.
val destroy : 'a events -> unit
destroy evs
removes the callbacks registred byevs
. It's important to perform this whenever you no longer need the events asevs
needs to register callbacks with the document to correctly capture mouse ups.
Mouse position
val pos : 'a events -> 'a Note.signal
pos evs
is the current mouse position in the target.
val dpos : 'a events -> 'a Note.event
dpos evs
occurs on mouse moves with current mouse position minus the previous position.
val mem : 'a events -> bool Note.signal
mem evs
istrue
whenever the mouse position is inside the target.
Mouse buttons
val left : 'a events -> bool Note.signal
left evs
istrue
whenever the left mouse button went down in the target and did not go up yet.
val left_down : 'a events -> 'a Note.event
left_down evs
has an occurence with the mouse position whenever the button goes down in the target.
val left_up : 'a events -> 'a Note.event
left_up evs
istrue
whenever the left mouse button went down in the target and goes back up anywhere. Note that the reported position might not be in the target.
Mouse cursors
module Cursor : sig ... end
Mouse cursors.