Using user controls with Google Maps KeyDragZoom - how to activate drag and drop scaling?

I am using KeyDragZoom

http://google-maps-utility-library-v3.googlecode.com/svn/tags/keydragzoom/2.0.5/docs/examples.html

I would like to place the control in a different place on the page, and not on the google map. I can’t figure out how to do this. It would even be nice for me if there was a button from the map that would simply trigger a button click on the map. How to activate drag scaling?

PS I use Visual Zoom Zoom Control instead of using keyboard keys such as shift.

+1
source share
2 answers

Finished doing this $('img[src=http://maps.gstatic.com/mapfiles/ftr/controls/dragzoom_btn.png]').click();

Thanks hookedonwinter

+1
source

The accepted answer assumes that the zoom control is on the map. If visualEnabled is false, the dragzoom_btn image will not exist.

A hack that seems to work:

 function onZoomClick() { var myKeyDragZoom = map.getDragZoomObject(); myKeyDragZoom.hotKeyDown_ = !myKeyDragZoom.hotKeyDown_; } 

When pressed, the zoom mode is activated. When you press or draw a rectangle again, the zoom mode is automatically turned off.

0
source

Source: https://habr.com/ru/post/1369234/


All Articles