package incr_dom

  1. Overview
  2. Docs

Module Incr_dom.Js_miscSource

This module has a small collection of helpful bits of javascript that have no other obvious home.

Sourcemodule Rect : sig ... end
Sourceval round_float_rect : ?round:(float -> int) -> float Rect.t -> int Rect.t
Sourceval viewport_rect : unit -> int Rect.t

viewport_rect () gives you the rectangle that corresponds to the size of the entire browser window

Sourceval viewport_rect_of_element : Js_of_ocaml.Dom_html.element Js_of_ocaml.Js.t -> float Rect.t

viewport_rect_of_element el gives you the bounding box rectangle for a single element

Sourceval client_rect : unit -> int Rect.t

client_rect () gives you the rectangle that corresponds to the size of the entire browser window without the scroll bars.

Sourceval client_rect_of_element : Js_of_ocaml.Dom_html.element Js_of_ocaml.Js.t -> float Rect.t

client_rect_of_element el gives you the inner box rectangle for a single element, not including its scroll bars if it has any.

Sourceval element_is_in_viewport : Js_of_ocaml.Dom_html.element Js_of_ocaml.Js.t -> bool

Returns true iff the element in question is in view.

Sourceval scroll : ?id:string -> unit -> unit

Find an element with an id (default as "keep-in-view"), and, if it exists, scrolls the UI so that that element is in view.

Sourcetype rows_or_columns =
  1. | Rows
  2. | Columns
Sourceval sexp_of_rows_or_columns : rows_or_columns -> Sexplib0.Sexp.t
Sourceval rows_or_columns_of_sexp : Sexplib0.Sexp.t -> rows_or_columns
Sourceval bin_shape_rows_or_columns : Core.Bin_prot.Shape.t
Sourceval bin_size_rows_or_columns : rows_or_columns Core.Bin_prot.Size.sizer
Sourceval bin_write_rows_or_columns : rows_or_columns Core.Bin_prot.Write.writer
Sourceval bin_read_rows_or_columns : rows_or_columns Core.Bin_prot.Read.reader
Sourceval __bin_read_rows_or_columns__ : (int -> rows_or_columns) Core.Bin_prot.Read.reader
Sourceval columns : rows_or_columns
Sourceval is_rows : rows_or_columns -> bool
Sourceval is_columns : rows_or_columns -> bool
Sourceval rows_val : rows_or_columns -> unit option
Sourceval columns_val : rows_or_columns -> unit option
Sourceval compare_rows_or_columns : rows_or_columns -> rows_or_columns -> int
Sourceval find_visible_range : length:int -> nth_element_id:(int -> string) -> rows_or_columns -> (int * int) option

find_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.

scroll_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

OCaml

Innovation. Community. Security.