Remove the current location layer if an asset has no location.
This commit is contained in:
parent
19db0bd560
commit
01c7147ddb
|
@ -3,7 +3,7 @@
|
|||
// wkt from the hidden input field and preview it on the map.
|
||||
Drupal.ajax.prototype.commands.previewCurrentLocation = function() {
|
||||
var wkt = $('#current-location input[name="move[current_location]"]').val();
|
||||
if (wkt) {
|
||||
if (wkt !== 'undefined') {
|
||||
farmOS.map.behaviors.move.previewCurrentLocation(wkt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
this.currentLocationLayer = null;
|
||||
}
|
||||
|
||||
// Only add a layer if WKT is not an empty string.
|
||||
if (wkt.length > 0) {
|
||||
|
||||
// Create current location layer with the WKT.
|
||||
// Do not put the layer inside a group, because map.removeLayer() (used
|
||||
// above) does not recurse into layer groups.
|
||||
|
@ -42,6 +45,7 @@
|
|||
};
|
||||
this.currentLocationLayer = this.instance.addLayer('wkt', opts);
|
||||
this.instance.zoomToVectors();
|
||||
}
|
||||
},
|
||||
|
||||
// Recreate the Movement map layer.
|
||||
|
|
Loading…
Reference in New Issue