add marker options
This commit is contained in:
parent
69024b75da
commit
6aca93ebe9
4 changed files with 68 additions and 6 deletions
|
|
@ -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 |]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue