aboutsummaryrefslogtreecommitdiff
path: root/src/View/Map
diff options
context:
space:
mode:
authorJoris2020-08-08 21:04:28 +0200
committerJoris2020-08-08 21:04:28 +0200
commit38e42723a916b7d5c2a15e514b3f3e6dcab398dd (patch)
tree1b7415ae64ac9768b12fc4d543ee61d615d11e7e /src/View/Map
parent3e39f97d844dbe0ff5f57e3977bc220d366d4c0e (diff)
Propose already defined colors in the form
Diffstat (limited to 'src/View/Map')
-rw-r--r--src/View/Map/Marker.ml17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/View/Map/Marker.ml b/src/View/Map/Marker.ml
index e793742..80072af 100644
--- a/src/View/Map/Marker.ml
+++ b/src/View/Map/Marker.ml
@@ -1,4 +1,4 @@
-let form on_validate init_name init_color init_icon =
+let form on_validate colors init_name init_color init_icon =
let name = ref init_name in
let color = ref init_color in
let icon = ref init_icon in
@@ -19,7 +19,7 @@ let form on_validate init_name init_color init_icon =
[| Layout.section
[| |]
[| Form.input "g-MarkerForm__Name" "Name" init_name (fun newName -> name := newName)
- ; Form.color_input "g-MarkerForm__Color" "Color" init_color (fun newColor -> color := newColor)
+ ; Form.color_input colors "g-MarkerForm__Color" "Color" init_color (fun newColor -> color := newColor)
; H.div
[| HA.class_ "g-Form__Field" |]
[| H.div
@@ -59,7 +59,7 @@ let form on_validate init_name init_color init_icon =
|]
-let create on_remove on_update pos init_name init_color init_icon =
+let create on_remove on_update colors pos init_name init_color init_icon =
let marker =
Leaflet.marker pos
{ title = init_name
@@ -72,8 +72,13 @@ let create on_remove on_update pos init_name init_color init_icon =
let () = Leaflet.on marker "contextmenu" (fun event ->
ContextMenu.show
(Leaflet.original_event event)
- [| { label = "Modify"; action = fun _ -> Modal.show (form (on_update pos pos) init_name init_color init_icon) }
- ; { label = "Remove"; action = fun _ -> on_remove pos }
+ [| { label = "Modify"
+ ; action = fun _ ->
+ Modal.show (form (on_update pos pos) colors init_name init_color init_icon)
+ }
+ ; { label = "Remove"
+ ; action = fun _ -> on_remove pos
+ }
|])
in
@@ -83,6 +88,6 @@ let create on_remove on_update pos init_name init_color init_icon =
on_update pos newPos init_name init_color init_icon) in
let () = Leaflet.on marker "dblclick" (fun _ ->
- Modal.show (form (on_update pos pos) init_name init_color init_icon)) in
+ Modal.show (form (on_update pos pos) colors init_name init_color init_icon)) in
marker