Event.MouseSourceThe type for mouse events.
Carries cursor coordinates, modifier keys, propagation control, and hit-testing metadata. Variant-specific data (button, source, scroll direction) is accessed by pattern-matching on kind.
Only stop_propagation and prevent_default mutate the event; all other fields are immutable after construction.
The type for mouse buttons.
equal_button a b is true iff a and b are the same button.
pp_button formats a button value.
type modifier = Input.Key.modifier = {ctrl : bool;Control key held.
*)alt : bool;Alt / Option key held.
*)shift : bool;Shift key held.
*)super : bool;Super / Windows / Command key held.
*)hyper : bool;Hyper key held.
*)meta : bool;Meta key held.
*)caps_lock : bool;Caps Lock active.
*)num_lock : bool;Num Lock active.
*)}The type for modifier key state. Re-exported from Input.Key.modifier.
equal_modifier a b is true iff all modifier fields of a and b are equal.
pp_modifier formats a modifier value.
The type for scroll-wheel directions. Re-exported from Input.Mouse.scroll_direction.
equal_scroll_direction a b is true iff a and b are the same direction.
pp_scroll_direction formats a scroll_direction value.
Each variant carries exactly the data relevant to that kind of event. Common fields (coordinates, modifiers, target) are accessed via x, y, modifiers, and target.
type kind = | Down of {}Button pressed.
*)| Up of {}Button released. is_dragging is true iff a drag was in progress when the button was released.
| MoveCursor moved with no button pressed.
*)| Drag of {}Cursor moved with button held. is_dragging is true iff the drag threshold has been exceeded.
| Drag_end of {}Drag gesture ended; button was the dragging button.
| Drop of {}Drop target reached. source is the node identifier of the drag source, if known.
| Over of {}Cursor moved over a potential drop target. source is the node identifier of the drag source, if known.
| OutCursor left a node during a drag.
*)| Scroll of {direction : scroll_direction;delta : int;}Scroll-wheel event. delta is the number of steps in direction.
The type for mouse event kinds.
equal_kind a b is true iff a and b are the same constructor and carry equal payloads.
pp_kind formats a kind value.
make ~x ~y ~modifiers ?target kind is a mouse event at (x, y) with modifier state modifiers, optional hit-test node target, and event kind kind. Propagation and default-prevention flags start as false.
target defaults to None.
stop_propagation t prevents t from bubbling to ancestor nodes.
propagation_stopped t is true iff stop_propagation has been called on t.
prevent_default t marks renderer-level default behaviour as prevented. This only suppresses renderer-defined defaults (for example, starting a text selection on mouse-down); it does not stop bubbling. Use stop_propagation to prevent bubbling to ancestors.
default_prevented t is true iff prevent_default has been called on t.
equal a b is true iff a and b have the same kind, coordinates, modifiers, and target. Dispatch control state is ignored.
pp formats a mouse event for debugging.