package mosaic
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/mosaic.ui/Mosaic_ui/Event/Mouse/index.html
Module Event.MouseSource
The 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.
Supporting types
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.
Event kinds
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_draggingistrueiff a drag was in progress when the button was released.| Move(*Cursor moved with no button pressed.
*)| Drag of {}(*Cursor moved with
*)buttonheld.is_draggingistrueiff the drag threshold has been exceeded.| Drag_end of {}(*Drag gesture ended;
*)buttonwas the dragging button.| Drop of {}(*Drop target reached.
*)sourceis the node identifier of the drag source, if known.| Over of {}(*Cursor moved over a potential drop target.
*)sourceis the node identifier of the drag source, if known.| Out(*Cursor left a node during a drag.
*)| Scroll of {direction : scroll_direction;delta : int;
}(*Scroll-wheel event.
*)deltais the number of steps indirection.
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.
Construction
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.
Accessors
Dispatch control
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.