Module Ojw_event_tools

module Ojw_event_tools : sig..end

Various tools related to events.


Position and Coordination

type position_type =  | Client | Screen | Page
type touch_type =  | All_touches | Target_touches | Changed_touches
val cmp_coord : int * int -> int * int -> bool

Take two coordinates and return true if they are equal

Mouse
val get_mouse_ev_coord : 
  ?p_type:position_type ->
  Dom_html.mouseEvent Js.t -> int * int

p_type : Client by default.

val get_local_mouse_ev_coord : 
  #Dom_html.element Js.t ->
  ?p_type:position_type ->
  Dom_html.mouseEvent Js.t -> int * int

Similar to get_mouse_ev_coord. Calculate the position of the mouse inside a given element.

Touch
val get_touch_coord : 
  ?p_type:position_type ->
  Dom_html.touch Js.t -> int * int

p_type : Client by default.

val get_touch_ev_coord : 
  ?t_type:touch_type ->
  int ->
  ?p_type:position_type ->
  Dom_html.touchEvent Js.t -> int * int

Similar to get_touch_coord. Take the index of touch (for multi-touch) as argument.

Similar to get_touch_ev_coord. Calculate the position of the touch inside a given element. Take the index of touch (for multi-touch) as argument.

t_type : All_touches by default.

val get_local_touch_ev_coord : 
  #Dom_html.element Js.t ->
  ?t_type:touch_type ->
  int ->
  ?p_type:position_type ->
  Dom_html.touchEvent Js.t -> int * int

Enable or disable events

val disable_event : 
  'a #Dom.event Js.t Dom_html.Event.typ ->
  #Dom_html.eventTarget Js.t -> Dom_html.event_listener_id

Disable Dom_html.Event with stopping propagation during capture phase *

val enable_event : Dom_html.event_listener_id -> unit

Enable Dom_html.Event with id given by disable_event *

val enable_events : Dom_html.event_listener_id list -> unit
val disable_drag_and_drop : 
  #Dom_html.eventTarget Js.t -> Dom_html.event_listener_id list