This module has a small collection of helpful bits of javascript that have no other obvious home.
module Rect : sig ... endval viewport_rect : unit ‑> int Rect.tviewport_rect () gives you the rectangle that corresponds to the size of the entire
browser window
val viewport_rect_of_element : Incr_dom__.Js_of_ocaml.Dom_html.element Incr_dom__.Js_of_ocaml.Js.t ‑> int Rect.tviewport_rect_of_element el gives you the bounding box rectangle for a single
element
val element_is_in_viewport : Incr_dom__.Js_of_ocaml.Dom_html.element Incr_dom__.Js_of_ocaml.Js.t ‑> boolReturns true iff the element in question is in view.
val scroll : ?id:string ‑> unit ‑> unitFind an element with an id (default as "keep-in-view"), and, if it exists, scrolls the UI so that that element is in view.
include sig ... endval compare_rows_or_columns : rows_or_columns ‑> rows_or_columns ‑> intval rows : rows_or_columnsval columns : rows_or_columnsmodule Variants_of_rows_or_columns : sig ... endval bin_rows_or_columns : rows_or_columns Bin_prot.Type_class.tval bin_read_rows_or_columns : rows_or_columns Bin_prot.Read.readerval __bin_read_rows_or_columns__ : (int ‑> rows_or_columns) Bin_prot.Read.readerval bin_reader_rows_or_columns : rows_or_columns Bin_prot.Type_class.readerval bin_size_rows_or_columns : rows_or_columns Bin_prot.Size.sizerval bin_write_rows_or_columns : rows_or_columns Bin_prot.Write.writerval bin_writer_rows_or_columns : rows_or_columns Bin_prot.Type_class.writerval bin_shape_rows_or_columns : Bin_prot.Shape.tval rows_or_columns_of_sexp : Sexplib.Sexp.t ‑> rows_or_columnsval sexp_of_rows_or_columns : rows_or_columns ‑> Sexplib.Sexp.tval find_visible_range : length:int ‑> nth_element_id:(int ‑> string) ‑> rows_or_columns ‑> (int * int) optionfind_visible_range ~length ~nth_element_id layout is useful to find visible rows or
columns of a table. The time cost is O(log(length)). It assumes the rows/columns are
non-overlapping and arranged monotonically, though the order doesn't matter. It's
assumed that the rows are laid out from 0 to length - 1.
If no row is visible, then None is returned. Otherwise, the inclusive upper and
lower bounds of the visible rows are returned.
val get_scroll_container : Incr_dom__.Js_of_ocaml.Dom.#node Incr_dom__.Js_of_ocaml.Js.t ‑> Incr_dom__.Js_of_ocaml.Dom.node Incr_dom__.Js_of_ocaml.Js.tscroll_container node finds the closest scrollable ancestor in the DOM tree.
If there is no scrollable element above the node passed in, then the document
will be returned