package leaflet
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file map.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
(* BSD-2-Clause License *) type t = Jv.t let of_jv = Fun.id let to_jv = Fun.id let create_on ?(options = Jv.null) id = Jv.call Global.leaflet "map" [| Jv.of_string id; options |] let create_from_div ?(options = Jv.null) container = if Brr.El.has_tag_name Brr.El.Name.div container then Jv.call Global.leaflet "map" [| Brr.El.to_jv container; options |] else failwith "container is not a <div>" let invalidate_size map = let (_ : Jv.t) = Jv.call map "invalidateSize" [| Jv.true' |] in () let fit_world map = let (_ : Jv.t) = Jv.call map "fitWorld" [||] in () let get_container map = Jv.call (to_jv map) "getContainer" [||] |> Brr.El.of_jv let set_view latlng ~zoom map = let latlng = Latlng.to_jv latlng in let (_ : Jv.t) = match zoom with | None -> Jv.call map "setView" [| latlng |] | Some zoom -> Jv.call map "setView" [| latlng; Jv.of_int zoom |] in () let on : type kind. kind Event.sub -> (kind Event.t -> unit) -> t -> unit = fun event handler map -> let name = Event.sub_to_string event in let handler v = handler @@ Event.of_jv event v in let (_ : Jv.t) = Jv.call map "on" [| Jv.of_string name; Jv.repr handler |] in () let get_center map = Latlng.of_jv @@ Jv.call map "getCenter" [||] let get_zoom map = Jv.call map "getZoom" [||] |> Jv.to_int let wrap_latlng latlng map = Latlng.of_jv @@ Jv.call map "wrapLatLng" [| Latlng.to_jv latlng |] let open_popup popup map = ignore @@ Jv.call map "openPopup" [| Popup.to_jv popup |] let close_popup popup map = ignore @@ match popup with | None -> Jv.call map "closePopup" [||] | Some popup -> Jv.call map "closePopup" [| Popup.to_jv popup |]
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>