From 38e42723a916b7d5c2a15e514b3f3e6dcab398dd Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 8 Aug 2020 21:04:28 +0200 Subject: Propose already defined colors in the form --- src/View/Map.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/View/Map.ml') diff --git a/src/View/Map.ml b/src/View/Map.ml index b46557d..678f5ae 100644 --- a/src/View/Map.ml +++ b/src/View/Map.ml @@ -8,6 +8,9 @@ let mapView = ; HA.href "#" |] [| H.text "Map" |] + ; Button.text + [| HE.on_click (fun _ -> Modal.show (Colors.content ())) |] + [| H.text "Colors" |] |] ; H.div [| HA.class_ "g-Map" |] @@ -48,9 +51,10 @@ let installMap () = () in let () = state := state_from_hash () in + let colors = State.colors !state in let () = Js.Array.forEach - (fun (m: State.marker_state) -> Leaflet.add_layer markers (Marker.create on_remove on_update m.pos m.name m.color m.icon)) + (fun (m: State.marker_state) -> Leaflet.add_layer markers (Marker.create on_remove on_update colors m.pos m.name m.color m.icon)) !state in if focus then @@ -89,7 +93,8 @@ let installMap () = | Some m -> { m with pos = pos; name = "" } | _ -> { pos = pos; name = ""; color = "#3f92cf"; icon = "" } in - Modal.show (Marker.form (add_marker pos) marker.name marker.color marker.icon)) + let colors = State.colors !state in + Modal.show (Marker.form (add_marker pos) colors marker.name marker.color marker.icon)) } |]) -- cgit v1.2.3