From 91dc6dde941cf31111ab6a95d560f334f5fabe02 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 24 Jun 2019 18:21:02 +0100 Subject: [PATCH] Ability to turn gridsquare map on and off --- application/views/interface_assets/footer.php | 8 +++++++- assets/js/leaflet/leafembed.js | 12 ++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index f67386cb..c1c411e1 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -100,6 +100,7 @@ $(document).ready(function(){ uri->segment(1) == "logbook" && $this->uri->segment(2) != "view") { ?> + diff --git a/assets/js/leaflet/leafembed.js b/assets/js/leaflet/leafembed.js index 051a9387..32c77624 100644 --- a/assets/js/leaflet/leafembed.js +++ b/assets/js/leaflet/leafembed.js @@ -23,11 +23,19 @@ function initmap(ShowGrid = 'No') { // start the map in South-East England map.setView(new L.LatLng(q_lat, q_lng), q_zoom); - map.addLayer(osm); - + + map.addLayer(osm); askForPlots(); + map.on('moveend', onMapMove); + if(ShowGrid == "Yes") { + var maidenhead = L.maidenhead().addTo(map); + } + + var layerControl = new L.Control.Layers(null, { + 'Gridsquares': maidenhead = L.maidenhead() + }).addTo(map); } function getXmlHttpObject() {