module Height_cache : sig ... end
Height_cache keeps track of the rendered height of items so that scrolling to a given position can decide which elements to render accurately. This allows rows to have different heights and change height at runtime.
val create : rows:'v Key.Map.t Incr_dom_widgets__.Import.Incr.t ‑> height_cache:Height_cache.t Incr_dom_widgets__.Import.Incr.t ‑> measurements:Incr_dom_widgets__.Partial_render_list_intf.Measurements.t option Incr_dom_widgets__.Import.Incr.t ‑> 'v t Incr_dom_widgets__.Import.Incr.t
val spacer_heights : _ t Incr_dom_widgets__.Import.Incr.t ‑> (float * float) Incr_dom_widgets__.Import.Incr.t
(top, bottom) spacer pixel heights to put the rendered rows in the right place
val scroll_into_scroll_region : ?in_:Util.Scroll_region.t ‑> _ t ‑> top_margin:float ‑> bottom_margin:float ‑> key:Key.t ‑> Util.Scroll_result.t
Scroll the view to the row with the given key, scrolling the minimum amount possible
while still being (top|bottom)_margin
pixels away from the top and bottom of the
screen. If this can't be satisfied, the margin will be reduced to the point where it
can. If a margin of 0 can't show the whole element, it will prefer showing the top.
?in
determines the element which should be scrolled. Default is `Window
val scroll_to_position : ?in_:Util.Scroll_region.t ‑> _ t ‑> position:float ‑> key:Key.t ‑> Util.Scroll_result.t
val scroll_to_position_and_into_region : ?in_:Util.Scroll_region.t ‑> _ t ‑> position:float ‑> top_margin:float ‑> bottom_margin:float ‑> key:Key.t ‑> Util.Scroll_result.t
is_in_region
and get_position
return None
if the given key does not exist or
the view rect and list rect measurements are not yet available.
val measure_heights_simple : _ t ‑> measure:(Key.t ‑> float option) ‑> Height_cache.t
measure_heights_simple
updates a height cache by measuring the rendered elements,
relying on the app to provide a function for finding and measuring the element for a
given key.
This function can be used for table with collapsed borders and box sizing set to
border-box.
val measure_heights : _ t ‑> measure_row:(Key.t ‑> 'm option) ‑> get_row_height:(prev:'m option ‑> curr:'m option ‑> next:'m option ‑> float option) ‑> Height_cache.t
measure_heights
is like measure_heights_simple
, but allows the app to use the
previous and next rows in addition to the current row to measure the current row's
height (e.g. using the bottom position of the previous row and/or the top position
of the next row).
To avoid retaking the same measures three times for each row (once as the "previous"
row, once as the "current" row, and once as the "next" row), measure_row
allows
the app to specify what measurements to take for a given row, and it is called
exactly once per row.
This function should be used for tables with non-collapsed borders.