ngx-openlayers icon indicating copy to clipboard operation
ngx-openlayers copied to clipboard

How to prevent page scrolling while map zooming in/out with mouse scroll?

Open MSkraburski opened this issue 8 years ago • 6 comments

As stated above. I would like to disable page scroll while mouse scrolling inside map div. Is there a way to do that?

MSkraburski avatar Nov 14 '17 16:11 MSkraburski

Hey MSkraburski, could you tell us which browser you're using ?

In safari/chrome, I don't get page scroll when I'm scrolling inside the map canvas.

Could you report if you have the same behaviour in this example : https://openlayers.org/en/latest/examples/mousewheel-zoom.html

quentin-ol avatar Nov 18 '17 10:11 quentin-ol

I checked it only in Chrome, since that's the main browser I use.

In sent example everything seems to work fine, no bugs or issues to report... Any ideas what might cause my problems? Regards

MSkraburski avatar Nov 20 '17 14:11 MSkraburski

I have the same issue. The OpenLayers example pages work fine, but this the angular component scrolls while using mouse-wheel zoom. Any solution?

Ghostbird avatar May 08 '18 11:05 Ghostbird

Silent is golden.

usb248 avatar Jan 20 '21 16:01 usb248

A quick fix could be to listen to scroll event at canvas level, and then to stop this event's propagation so it wouldn't impact map's container (not tested though)

dabbid avatar Jan 21 '21 08:01 dabbid