Vue2leaflet: Map initialization - gestureHandling

Created on 7 Aug 2019  路  4Comments  路  Source: vue-leaflet/Vue2Leaflet

Hello,

I am trying to add gesturehandling so that the user won't unzoom when scrolling down.

I installed leaflet-gesture-handling through npm

import { GestureHandling } from "leaflet-gesture-handling";
L.Map.addInitHook("addHandler", "gestureHandling", GestureHandling);

but this doesn't do anything
@update:center="centerUpdate" @update:zoom="zoomUpdate">

any idea how to do this?

thanks a lot!

Most helpful comment

Actually yes! Here is my code:

<l-map ref="map" gestureHandling :options="mapOptions">

import { GestureHandling } from "leaflet-gesture-handling";

  data () {
    return {
      mapOptions: {
        zoomSnap: 0.5,
        gestureHandling:true
      }
   }

All 4 comments

it works with this.$refs.map.mapObject.zoomOut();
So now I would like to fit bounds content... this doesn't work though
this.$refs.map.mapObject.fitBounds(this.$refs.map.mapObject.getBounds());

@mawieutc

it works with this.$refs.map.mapObject.zoomOut();
So now I would like to fit bounds content... this doesn't work though
this.$refs.map.mapObject.fitBounds(this.$refs.map.mapObject.getBounds());

I am attempting to use gestureHandler plugin also but have not been able to get it to work. Did you end up finding a solution?

Actually yes! Here is my code:

<l-map ref="map" gestureHandling :options="mapOptions">

import { GestureHandling } from "leaflet-gesture-handling";

  data () {
    return {
      mapOptions: {
        zoomSnap: 0.5,
        gestureHandling:true
      }
   }

@mawieutc

Perfect! That worked like a charm. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DmitriyVTitov picture DmitriyVTitov  路  4Comments

tiltec picture tiltec  路  4Comments

digEmAll picture digEmAll  路  4Comments

carlmjohnson picture carlmjohnson  路  4Comments

CharlesOkwuagwu picture CharlesOkwuagwu  路  5Comments