jump to coordinate feature added to the header stripe #25

Merged
balazs merged 4 commits from feature/jump-to-specific-coordinates-in-mapeditor into develop 2021-04-27 15:56:35 +00:00
2 changed files with 9 additions and 13 deletions
Showing only changes of commit faaff33841 - Show all commits

No files matched your search

-4
View File
@@ -7,10 +7,6 @@
z-index: 1;
}
#jumpForm {
display: inline;
}
/* modify the cursor for the Leaflet map */
Outdated
Review

Is this necessary?

Is this necessary?
Outdated
Review

True. Not necessary anymore. I wanted to put the text input and button inside a form, but the form tag somehow breaks the template and stops the subheader yield before the form.
I'll remove it.

True. Not necessary anymore. I wanted to put the text input and button inside a form, but the form tag somehow breaks the template and stops the subheader yield before the form. I'll remove it.
.leaflet-container {
cursor: crosshair;
+9 -9
View File
1
@@ -357,23 +357,23 @@
}
},
extractCoordinates: function(coordinatesStr) {
var coordinates = {valid: false, latlng: {lat: 0., lng: 0.}};
extractCoordinates: function (coordinatesStr) {
var coordinates = { valid: false, latlng: { lat: 0., lng: 0. } };
var delimiters = [',', ' ', ';'];
coordinatesStr = coordinatesStr.trim();
if(coordinatesStr.length == 0) {
if (coordinatesStr.length == 0) {
return coordinates;
}
for(var delimiter of delimiters) {
if(coordinatesStr.indexOf(delimiter) != -1) {
for (var delimiter of delimiters) {
if (coordinatesStr.indexOf(delimiter) != -1) {
var coordinatesArr = coordinatesStr.split(delimiter);
coordinates.latlng.lat = parseFloat(coordinatesArr[0]);
coordinates.latlng.lng = parseFloat(coordinatesArr[1]);
if( !isNaN(coordinates.latlng.lat) && !isNaN(coordinates.latlng.lng) ) {
if (!isNaN(coordinates.latlng.lat) && !isNaN(coordinates.latlng.lng)) {
coordinates.valid = true;
return coordinates;
}
@@ -477,7 +477,7 @@
var coordinatesStr = document.getElementById("jumpCoordinates").value;
var coordinates = Util.extractCoordinates(coordinatesStr);
if(coordinates.valid) {
if (coordinates.valid) {
MapEditor.placeMarker(coordinates.latlng);
}
};
@@ -487,10 +487,10 @@
var coordinates = Util.extractCoordinates(coordinatesStr);
var jumpButton = document.getElementById("jumpButton");
if(coordinates.valid) {
if (coordinates.valid) {
jumpButton.disabled = false;
if(e.key == 'Enter') {
if (e.key == 'Enter') {
MapEditor.placeMarker(coordinates.latlng);
}
}