diff --git a/webgui/topics/Map.html b/webgui/topics/Map.html
index e80bf7204..f747b4536 100644
--- a/webgui/topics/Map.html
+++ b/webgui/topics/Map.html
@@ -5,6 +5,11 @@
attributionControl: true,
zoom: 11
},
+ on: {
+ 'resize': mapResize,
+ 'zoomend': mapZoomend,
+ 'moveend': mapMoveend,
+ },
css: {
width: '100%',
height: '100%'
diff --git a/webgui/topics/Map.js b/webgui/topics/Map.js
index b316f19d6..14804016f 100644
--- a/webgui/topics/Map.js
+++ b/webgui/topics/Map.js
@@ -174,6 +174,18 @@ define([
attribution : '© open weather map',
}),
}
+ self.mapResize = function(a,b) {
+ self.overlays.NavDB.invalidate();
+ }
+
+ self.mapZoomend = function() {
+ self.overlays.NavDB.invalidate();
+ }
+
+ self.mapMoveend = function() {
+ self.overlays.NavDB.invalidate();
+ }
+
}
ViewModel.prototype.dispose = function() {
diff --git a/webgui/topics/Map/NavdbLayer.js b/webgui/topics/Map/NavdbLayer.js
index 18cf15120..6539c03f6 100644
--- a/webgui/topics/Map/NavdbLayer.js
+++ b/webgui/topics/Map/NavdbLayer.js
@@ -142,11 +142,13 @@
dirty : true,
updateId : 0,
update : function(id) {
+ var that = this;
+
if (this.updateId != id)
return;
if (this.dirty) {
- // this.dirty = false;
+ this.dirty = false;
var bounds = this._map.getBounds();
// radius in NM
var radius = bounds.getSouthWest().distanceTo(bounds.getNorthEast()) / 3704;
@@ -168,7 +170,6 @@
var url = "/navdb?q=findWithinRange&type=" + filter + "&range=" + radius + "&lat=" + lat + "&lon=" + lon;
- var that = this;
var jqxhr = $.get(url).done(function(data) {
if (that.updateId == id) {
that.clearLayers();