Leaflet: Zoom out via double right click Edit

Created on 14 Feb 2013  路  10Comments  路  Source: Leaflet/Leaflet

I'm used to zooming out via double right click, which doesn't work with Leaflet. On normal google map, this works fine.

feature

Most helpful comment

It is possible with

var Right_dblclick = false;

map.on("contextmenu", function(e) {
    if(Right_dblclick) {
        if (map.getZoom() > 2) {
            map.setZoom(map.getZoom() - 1);
        }
    } else {
        Right_dblclick = true;
        setTimeout(function(){Right_dblclick = false;}, 250);
    }
 });

All 10 comments

Is it just me or it double right click doesn't work on Google Maps or any other maps anymore?

The double right click zoom out worked for me tonight in Google Maps.

Weird... It seems that it doesn't work on my Macbook Pro at least. I'll try my Windows machine.

Works on google maps for me on chrome/windows

Works on Google Maps (MacbookAir, OSX 10.8).

Works on google maps for me on chrome/windows

Closing in favor of #2185

and the rationale for preferring shift double click is...?

@fgnievinski can be implemented reliably; already an established convention in OL3/Modest Maps/Polymaps.

It is possible with

var Right_dblclick = false;

map.on("contextmenu", function(e) {
    if(Right_dblclick) {
        if (map.getZoom() > 2) {
            map.setZoom(map.getZoom() - 1);
        }
    } else {
        Right_dblclick = true;
        setTimeout(function(){Right_dblclick = false;}, 250);
    }
 });
Was this page helpful?
0 / 5 - 0 ratings