Skodsgn
Skodsgn

Reputation: 981

Google maps API - disable double click zoom when click on Polyline

I have single polyline on my map. I add dblclick event to it. It is working but also map is zooming. How to disable zooming when double click on polyline? (Or anything else with dblclick event);

Any event propagation, event stop or something?

I know and I can use map.setOptions({disableDoubleClickZoom: true }); but it is not what i really want to do.

EDIT: STUPID HACK

In polyline 'dblclick' event just added at start : map.setZoom(map.getZoom-1);

Upvotes: 2

Views: 2573

Answers (2)

chrismarx
chrismarx

Reputation: 12545

This is the way to do this through the api:

google.maps.event.addListener(polygonObject,'dblclick',function(e){e.stop();})

Disabling zoom when double click on polygon

Upvotes: 4

Skodsgn
Skodsgn

Reputation: 981

STUPID HACK

In polyline 'dblclick' event just added at start : map.setZoom(map.getZoom-1);

So first u deacrease zoom and then increase.

Upvotes: 0

Related Questions