Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps v3 makes ZOOM OUT in rightclick event only in FIREFOX

In my case, happen something strange, with the GOOGLE MAPS API V3 I create a contextmenu when the user makes rightclick over the map, but, if i try to open the map in fIREFOX, when i make rightclick to show the ContextMenu, its works! but makes a ZOOM OUT too, at the same time, i detect that this happen ONLY in FIREFOX...What happen here? Im making something wrong?

like image 983
RaDiKaL EdWaRD Avatar asked Dec 21 '22 18:12

RaDiKaL EdWaRD


1 Answers

I had this exact same issue with Firefox, right click, zoom out. Major problem when you are trying to add right click functionality. It would appear the disableDoubleClickZoom resolves this issue but this is a good feature to have and I didn't want to lose it.

What I did is create two event listeners one for right click and one for normal click. In the right click event disable double click zoom:

google.maps.event.addListener(map, 'rightclick', function(e) {
    map.set('disableDoubleClickZoom', true);
});

Then on a normal click re-enable the double click zoom functionality:

google.maps.event.addListener(map, 'click', function(e) {
    map.set('disableDoubleClickZoom', false);       
});
like image 174
TehNrd Avatar answered Dec 28 '22 07:12

TehNrd