Avoid re-rendering map on every mousemove

This commit is contained in:
Tom Payne
2013-11-20 18:19:00 +01:00
parent 84dcf24511
commit d367560faf

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;
}
if (highlight !== oldHighlight) {
map.render();
}
};
$(map.getViewport()).on('mousemove', function(evt) {