list -> array

This commit is contained in:
Swrup 2024-01-30 16:55:19 +01:00
parent 3d91ee4ae6
commit bbd19599cd
9 changed files with 30 additions and 39 deletions

View file

@ -46,12 +46,12 @@ let opt_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, opt_to_jv o)) options in
let l = Array.of_list @@ (("iconUrl", Jv.of_string icon_url) :: l) in
let l = Array.map (fun o -> (to_string o, opt_to_jv o)) options in
let l = Array.append [| ("iconUrl", Jv.of_string icon_url) |] l in
Jv.call Global.leaflet "icon" [| Jv.obj l |]
let create_div ~html ~bg_pos options =
let l = List.map (fun o -> (to_string o, opt_to_jv o)) options in
let l = Array.map (fun o -> (to_string o, opt_to_jv o)) options in
let div_options =
let html =
match html with
@ -63,9 +63,9 @@ let create_div ~html ~bg_pos options =
| None -> []
| Some bg_pos -> [ ("bgPos", Point.to_jv bg_pos) ]
in
html @ bg_pos
html @ bg_pos |> Array.of_list
in
let l = Array.of_list @@ div_options @ l in
let l = Array.append div_options l in
Jv.call Global.leaflet "divIcon" [| Jv.obj l |]
let set_default_image_path s =