Avoid re-rendering map on every mousemove

This commit is contained in:
Tom Payne committed 2013-11-20 18:19:00 +01:00
1 parent 84dcf24511
commit d367560faf
1 file changed
+4 -1
+4 -1
View File
@@ -55,6 +55,7 @@ $.getJSON('data/countries.geojson', function(data) {
var highlight;
var displayFeatureInfo = function(pixel) {
var oldHighlight = highlight;
var coordinate = map.getCoordinateFromPixel(pixel);
var features = vectorSource.getAllFeaturesAtCoordinate(coordinate);
var info = document.getElementById('info');
@@ -66,7 +67,9 @@ var displayFeatureInfo = function(pixel) {
info.innerHTML = ' ';
highlight = undefined;
}
map.render();
if (highlight !== oldHighlight) {
map.render();
}
};
$(map.getViewport()).on('mousemove', function(evt) {