Break out of forEachFeatureAtPixel as soon as hit detected in vector-layer example

This commit is contained in:
Tom Payne
2013-12-02 16:25:56 +01:00
parent 41811e6566
commit f1a9f76841

View File

@@ -59,11 +59,8 @@ var highlight;
var displayFeatureInfo = function(pixel) { var displayFeatureInfo = function(pixel) {
var oldHighlight = highlight; var oldHighlight = highlight;
var feature; var feature = map.forEachFeatureAtPixel(pixel, function(feature) {
map.forEachFeatureAtPixel(pixel, function(f) { return feature;
if (!feature) {
feature = f;
}
}); });
var info = document.getElementById('info'); var info = document.getElementById('info');