E
E
EVOSandru62020-02-22 02:08:56
leaflet
EVOSandru6, 2020-02-22 02:08:56

How to disable mouse scroll zoom in vue-leaflet?

Good afternoon,

I didn’t find this feature in the documentation, so I searched on the forums: I found the scrollWheelZoom

solution :

<l-map :zoom="zoom"
        :center="computedCenter"
        :minZoom="12"
         :options="{scrollWheelZoom: false}
>


With this option, the map does not react to scrolling at all, which almost solves the problem.

The task is to make it so that only the approximation could be initiated by the scroll.

When scrolling back at a distance, the map should not be zoomed, but the page should scroll.

Maybe there is an option to track the scroll down event in the map or its wrapper?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-02-22
@EVOSandru6

:options="{ scrollWheelZoom: false }"
@update:zoom="zoom = $event"
@wheel.native="onWheel"

methods: {
  onWheel(e) {
    if (e.deltaY < 0) {
      this.zoom++;
      e.preventDefault();
    }
  },
},

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question