Browse Source

click on map change the crosshair location + map movement doesn't move the crosshair

Samuel 8 years ago
parent
commit
b1529a6e62
1 changed files with 13 additions and 2 deletions
  1. 13 2
      panorama/templates/panorama/main.html

+ 13 - 2
panorama/templates/panorama/main.html

@@ -199,18 +199,29 @@
             // Add in a crosshair for the map
             crosshair = new L.marker(map.getCenter(),{icon:crosshairIcon,draggable:true});
             crosshair.addTo(map);
+
+            // Change crosshair lat/lon when click on the map
+            map.on('click', function(e) {
+                crosshair.setLatLng(e.latlng)
+                if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
+                    fillCoord();
+                }
+
+            });
     
             // Move the crosshair to the center of the map when the user pans
-            map.on('move', function(e) {
+            /*map.on('move', function(e) {
                 crosshair.setLatLng(map.getCenter());
             });
-    
+            
             // Autofill forms while moving crosshair and expanding menus
             map.on('moveend', function(e) {
                 if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
                     fillCoord();
                 }
             });
+            */
+            // Autofill forms while moving crosshair and expanding menus
             crosshair.on('moveend', function(e) {
                 if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
                     fillCoord();