From 91c9517dac3d57b6e5a975f7e570f15cd73dfee1 Mon Sep 17 00:00:00 2001 From: leosw Date: Sun, 17 May 2020 19:30:23 +0400 Subject: [PATCH] Add cursor in poi editor --- controllers/d.poi.php | 2 ++ views/css/d.poi.css | 44 +++++++++++++++++++++++++++---------------- views/d.poi.edit.html | 29 +++++++++++++++++++++++++--- views/js/d.poi_map.js | 21 ++++++++++++++------- 4 files changed, 70 insertions(+), 26 deletions(-) diff --git a/controllers/d.poi.php b/controllers/d.poi.php index 9637960..dff1bfa 100755 --- a/controllers/d.poi.php +++ b/controllers/d.poi.php @@ -53,6 +53,8 @@ switch ($controller->splitted_url[1]) { $head['css'] .= ";../third/leaflet/leaflet.css;../third/leaflet-fullscreen/leaflet.fullscreen.css;../third/leaflet-easybutton/easy-button.css"; $head['js'] = "d.poi_map.js"; + $poi->lat = ""; $poi->lon = ""; $poi->alt = ""; + $new = 1; include ($config['views_folder']."d.poi.edit.html"); break; diff --git a/views/css/d.poi.css b/views/css/d.poi.css index 332c417..4aee9ad 100755 --- a/views/css/d.poi.css +++ b/views/css/d.poi.css @@ -42,19 +42,14 @@ html, body { /** Editor page **/ /*********************************/ -form.form input, form.form textarea, #locale { +form.form input, form.form textarea, form.form input[type=radio]:checked+label, #locale { background: #ddd; border-bottom: 2px solid #ccc; display: block; padding: 10px; } -form.form textarea { - font-size: 14px; - margin: 10px 0 10px 0px; - width: calc(100% - 20px); -} -form.form input { +form.form h1 input { width: 58%; margin: 10px 0 10px 0px; font-size: 18px; @@ -65,29 +60,46 @@ form.form input { font-size: 17px; } -form.form input[type=submit] { - width: auto; - margin: auto; - border-bottom: 2px solid blue; +#permalink { + width: 808px; + margin: 10px 0 0 0px; + padding: 6px; + font-size: 11px; + font-style: italic; + color: #555; + } -#type_selector { +.flex_line { display: flex; flex-direction: row; } + +.flex_line input[type=text] { + flex: 1; + margin: 10px 5px 0 5px; +} + +form.form input[type=submit] { + width: auto; + margin: 10px auto; + border-bottom: 2px solid blue; +} + form.form input[type=radio] { display: none; } form.form input[type=radio]+label { + font-size: 13px; flex: 1; text-align: center; - padding: 10px 5px; + padding: 10px; vertical-align: middle; border-bottom: 2px solid transparent; } -form.form input[type=radio]:checked+label { - background: #ddd; - border-bottom: 2px solid #ccc; +form.form input[type=radio]+label img { + width: 32px; + height: 32px; } /***************************************** diff --git a/views/d.poi.edit.html b/views/d.poi.edit.html index ad4f3ba..19fd445 100755 --- a/views/d.poi.edit.html +++ b/views/d.poi.edit.html @@ -14,7 +14,7 @@

-
+
@@ -27,10 +27,17 @@ - + + + + - +
+ + + +
@@ -39,6 +46,22 @@ diff --git a/views/js/d.poi_map.js b/views/js/d.poi_map.js index c7f6447..01b23e9 100755 --- a/views/js/d.poi_map.js +++ b/views/js/d.poi_map.js @@ -1,4 +1,5 @@ var mymap; +var poi_layer; $( document ).ready(function() { // Differents layers for the map @@ -40,13 +41,19 @@ $( document ).ready(function() { mymap.removeControl(mymap.attributionControl); - $(".close-link").click(function() { - $("footer").show(); - $("#footer-credits").hide(); - $("#footer-legend").hide(); - }); - mymap.on('baselayerchange', function(e) { $("#map-credits").html(e.layer.getAttribution()); }); -}); + + poi_layer = L.marker([-46.407, 51.766], {draggable: true}).addTo(mymap); + + mymap.on('click', function(e){ + poi_layer.setLatLng(e.latlng); + $("#lat").val(e.latlng.lat); + $("#lon").val(e.latlng.lng); + }) + poi_layer.on('move', function(e){ + $("#lat").val(e.latlng.lat); + $("#lon").val(e.latlng.lng); + }) +}); \ No newline at end of file