From d1135ff55db85ef81bbe2bd8f283cdbbd5464298 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 13 Jul 2020 21:30:32 +0200 Subject: Show map and add marks with right click --- src/View/Map.ml | 28 ++++++++++++++++++++++++++++ src/View/Map/MarkerForm.ml | 0 2 files changed, 28 insertions(+) create mode 100644 src/View/Map.ml create mode 100644 src/View/Map/MarkerForm.ml (limited to 'src/View') diff --git a/src/View/Map.ml b/src/View/Map.ml new file mode 100644 index 0000000..bcd0506 --- /dev/null +++ b/src/View/Map.ml @@ -0,0 +1,28 @@ +let render () = + let + _ = + Js.Global.setTimeout + (fun () -> + let map = Leaflet.map("g-Map__Content") in + let tileLayer = Leaflet.tileLayer "http://{s}.tile.osm.org/{z}/{x}/{y}.png" in + let () = Leaflet.addTo tileLayer map in + let () = Leaflet.setView map [| 51.505; -0.09 |] 13 in + Leaflet.on map "contextmenu" (fun (event) -> + Leaflet.addTo (Leaflet.marker (Leaflet.latLng event) { title = "Hey"; }) map)) + 0 + in + H.div + ~attributes:[| H.className "g-Layout__Page" |] + ~children: [| + H.div + ~attributes:[| H.className "g-Layout__Header" |] + ~children:[| H.text "Map" |] + (); + H.div + ~attributes:[| H.className "g-Map" |] + ~children:[| + H.div ~attributes:[| H.id "g-Map__Content" |] () + |] + (); + |] + () diff --git a/src/View/Map/MarkerForm.ml b/src/View/Map/MarkerForm.ml new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3