From 41811e6566167d3b06c9ac494a7f987f129cdc47 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 2 Dec 2013 16:25:44 +0100 Subject: [PATCH] Break out of forEachFeatureAtPixel as soon as hit detected in synthetic-points example --- examples/synthetic-points.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 2036efc48f..c740881fcd 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -64,9 +64,8 @@ var map = new ol.Map({ $(map.getViewport()).on('mousemove', function(e) { var pixel = map.getEventPixel(e.originalEvent); - var hit = false; - map.forEachFeatureAtPixel(pixel, function(feature) { - hit = true; + var hit = map.forEachFeatureAtPixel(pixel, function(feature) { + return true; }); if (hit) {