add marker options

This commit is contained in:
Swrup 2022-06-20 08:16:21 +02:00
parent 69024b75da
commit 6aca93ebe9
4 changed files with 68 additions and 6 deletions

View file

@ -2,6 +2,8 @@
type t = Jv.t
let to_jv = Fun.id
type opt =
| Icon_retina_url of string
| Icon_size of Point.t
@ -28,7 +30,7 @@ let to_string = function
| Class_name _ -> "className"
| Cross_origin _ -> "crossOrigin"
let to_jv = function
let opt_to_jv = function
| Icon_size p
| Icon_anchor p
| Popup_anchor p
@ -42,6 +44,6 @@ let to_jv = function
match o with Some s -> Jv.of_string s | None -> Jv.of_bool false )
let create icon_url options =
let l = List.map (fun o -> (to_string o, to_jv o)) options in
let l = List.map (fun o -> (to_string o, opt_to_jv o)) options in
let tab = Array.of_list @@ (("iconUrl", Jv.of_string icon_url) :: l) in
Jv.call Global.leaflet "icon" [| Jv.obj tab |]