better Layer.bind_popup and add Map.open/close_popup

This commit is contained in:
Swrup 2022-06-26 04:08:53 +02:00
parent 8579b9aeed
commit 9c54ddab97
6 changed files with 21 additions and 24 deletions

View file

@ -31,16 +31,10 @@ let remove_from : type kind. Map.t -> kind t -> unit =
let (_ : Jv.t) = Jv.call l "removeFrom" [| Map.to_jv map |] in
()
let bind_popup : type kind. Brr.El.t -> Popup.opt list -> kind t -> unit =
fun el options -> function
let bind_popup : type kind. Popup.t -> kind t -> unit =
fun popup -> function
| Basic layer | Geojson layer | Marker layer | Tile layer ->
let l =
Array.of_list
@@ List.map (fun o -> (Popup.opt_to_string o, Popup.opt_to_jv o)) options
in
let (_ : Jv.t) =
Jv.call layer "bindPopup" [| Brr.El.to_jv el; Jv.obj l |]
in
let (_ : Jv.t) = Jv.call layer "bindPopup" [| Popup.to_jv popup |] in
()
let unbind_popup : type kind. kind t -> unit = function