I'm implementing a mapping application with OpenLayers 3.

When there are too many overlays on the map (say you had to add too many location pins - see picture below), certain parts of the view-port have little or no space that will receive the mouse wheel events (i.e the overlay pins do not propagate the wheel events to the map) and the user thinks that his/her interaction is blocked.

How can I prevent this?

Simply put: I put a simple image as an overlay on a map and the mouse wheel event on that image is not propagated to the map, therefore the interaction ol.interaction.MouseWheelZoom is not triggered.

enter image description here

1 Answer 1


ol.Overlay has a stopEvent configuration option. If you set that to false, all events will propagate through the overlays.

That said, have you considered using an ol.layer.Vector for your pins, instead of adding each pin as overlay? This will give you better performance, especially if you have many pins.

  • Thank you Andreas, it just works. I wonder how that escaped my attention. About the vector layer option: I did that in another case, but is there a better way to work out an onclick event other than map.forEachFeatureAtPixel? And I also do small animations on mouse over, but that is dismissible for the sake of performance.
    – Ulas
    Dec 21, 2016 at 11:05
  • 1
    map.forEachFeatureAtPixel is the way to go. It is optimized for performance, so you should not need to worry about that. If you want to do animations, you might want to look into a style function that renders features returned by the current forEachFeatureAtPixel call differently.
    – ahocevar
    Dec 22, 2016 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.