How to enable/disable mouse wheel for zoom? #356
-
I'm trying to extract the info from vue3-openlayers and OpenLayers docs, but it's a bit difficult. So far I've reached this: In <script>:
In :
However, no matter if I set props.enableMouseWheel to true or false, mouse wheel is always disabled. It will only work if I remove the ":interactions=interactions" line in . I'm sure I'm missing something obvious, but I've tried for a few hours and no luck so far. Any hint is greatly appreciated :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Ok, found the way to access and edit interactions. My previous question was about disabling zoom, but now I switched to allowing zoom when pressing ctrl/cmd. In case someone else is looking for it, here's how to do it. In <script>, import this:
Second, in <script> too, create the map reference variable properly:
And then, whenever you want, do this:
For me the trickiest thing was figuring out that I have to remove and add in order to fully editing an interaction. I was trying to directly edit the precise interaction but OpenLayers doesn't allow that. |
Beta Was this translation helpful? Give feedback.
-
I released a new component |
Beta Was this translation helpful? Give feedback.
I released a new component
ol-interaction-mouse-wheel-zoom
which let's you define the mouse wheel zoom condition (can be deactivated this way):https://vue3openlayers.netlify.app/componentsguide/interactions/mousewheelzoom/