add documentation, remove Map.as_target

This commit is contained in:
Swrup 2022-05-19 22:42:28 +02:00
parent d242b1ac6e
commit 21bf82239b
7 changed files with 50 additions and 19 deletions

View file

@ -2,26 +2,43 @@
type t
(** [create container] creates a map on [container]. * To have a functional map
you will need to add a tile layer to it. *)
val create : ?options:Jv.t -> Brr.El.t -> t
(** [invalidate_size map] checks if the map container size changed and updates
the map if so *)
val invalidate_size : t -> unit
(** [set_view latlng Some(zoom) map] sets the view of the [map] (geographical
center and zoom) *)
val set_view : Latlng.t -> zoom:int option -> t -> unit
(** [fit_world map] sets a map view that mostly contains the whole world with
the maximum zoom level possible *)
val fit_world : t -> unit
(** [get_container map] is the HTML element that contains [map] *)
val get_container : t -> Brr.El.t
(** [on event handler map] add an event listener on [map] for event [event] with
handler [handler] *)
val on : 'a Event.sub -> ('a Event.t -> 'b) -> t -> unit
(** [get_center map] is the geographical center of the map view *)
val get_center : t -> Latlng.t
(** [get_zoom map] is the current zoom level of the map view *)
val get_zoom : t -> int
val wrapped_latlng : Latlng.t -> t -> Latlng.t
val as_target : t -> Brr.Ev.target
(** [wrap_latlng latlng map] returns a new [Latlng.t] where lat and lng has been
wrapped according to the map's CRS's wrapLat and wrapLng properties, if they
are outside the CRS's bounds. By default this means longitude is wrapped
around the dateline so its value is between -180 and +180 degrees *)
val wrap_latlng : Latlng.t -> t -> Latlng.t
(** [of_jv jv] is [jv] as {!t} *)
val of_jv : Jv.t -> t
(** [to_jv o] is [o] as {!Jv.t} *)
val to_jv : t -> Jv.t