|
@@ -116,8 +116,10 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
function fillCoord() {
|
|
function fillCoord() {
|
|
- var lat = map.getCenter().lat.toFixed(5);
|
|
|
|
- var lng = map.getCenter().lng.toFixed(5);
|
|
|
|
|
|
+ //var lat = map.getCenter().lat.toFixed(5);
|
|
|
|
+ //var lng = map.getCenter().lng.toFixed(5);
|
|
|
|
+ var lat = crosshair.getLatLng().lat.toFixed(5);
|
|
|
|
+ var lng = crosshair.getLatLng().lng.toFixed(5);
|
|
$('#id_custompoint-latitude').val(lat);
|
|
$('#id_custompoint-latitude').val(lat);
|
|
$('#id_newpano-latitude').val(lat);
|
|
$('#id_newpano-latitude').val(lat);
|
|
$('#id_newrefpoint-latitude').val(lat);
|
|
$('#id_newrefpoint-latitude').val(lat);
|
|
@@ -195,20 +197,36 @@
|
|
map.addLayer(osm);
|
|
map.addLayer(osm);
|
|
|
|
|
|
// Add in a crosshair for the map
|
|
// Add in a crosshair for the map
|
|
- crosshair = new L.marker(map.getCenter(), {clickable:false,icon:crosshairIcon});
|
|
|
|
|
|
+ crosshair = new L.marker(map.getCenter(),{icon:crosshairIcon,draggable:true});
|
|
crosshair.addTo(map);
|
|
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
|
|
// 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());
|
|
crosshair.setLatLng(map.getCenter());
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+
|
|
// Autofill forms while moving crosshair and expanding menus
|
|
// Autofill forms while moving crosshair and expanding menus
|
|
map.on('moveend', function(e) {
|
|
map.on('moveend', function(e) {
|
|
if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
|
|
if ($("#locate-gps,#new-pano,#new-refpoint").hasClass("collapse in")){
|
|
fillCoord();
|
|
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();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
$('#locate-gps-btn, #new-pano-btn, #new-refpoint-btn').click(function(e) {
|
|
$('#locate-gps-btn, #new-pano-btn, #new-refpoint-btn').click(function(e) {
|
|
fillCoord();
|
|
fillCoord();
|
|
});
|
|
});
|