Hi
I have a custom form using forms API where I select a location on a Gmap in one form and set a marker on a Gmap on another form.
I use the "gmap_set_location" function in gmap.module to create the map for the form.
I based my forms on the "location_latlon_form" function in location.inc that is used to collect user location and to set node location using gmap.

On all the forms (including the user location and node location forms), when you click on the map, it zooms in with 2 zoom positions together with moving location to centre of map. If you continue clicking, you end up with maximum zoom.

How can I stop the zoom?

I tried passing {$mymap}=>behavior=>autozoom = 0 with the map settings, but it has no effect.
(If I switch off autozoom in admin settings also does not work)

But I don't think the problem lies with autozoom.

CommentFileSizeAuthor
#3 no-js-locpick-zoom-patch.txt1.13 KBalan d.

Comments

Max_Headroom’s picture

Erhm:
{$mymap}['behavior']['autozoom'] = 0
but you get the idea :D

rosenblum68’s picture

Title: Selecting a location or marker cause map to zoom in by 2 every time. » FIX to LOCPICK.JS Selecting a location or marker cause map to zoom in by 2 every time.

It seems that location picker was going out of its way to zoom in like that.

/sites/all/modules/gmap/js/locpick.js

and commented out lines 32+33 (for the pick) and 41+42 (for the move).

// obj.map.zoomIn();
// obj.map.zoomIn();

(you might have to shift+reload a coupla times to get your browser to refresh the JS)

alan d.’s picture

Version: 6.x-1.0-rc1 » 6.x-1.x-dev
Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.13 KB

This issue is making the location picker unusable in IE on a fluid width theme. A click pans and moves randomly (it looks like there is no exact ordering on the 4 zoom and pan events via Google Map API) - so that a click on Australia zooms and positions somewhere in the Pacific usually; occasionally ends up in Antarctica or South America. The larger the map, the more likely it is to pan randomly.

So making this "feature" a bug. The double click / mouse wheel has zoom so this feature is not required IMHO.

Cheers

Sinan Erdem’s picture

This patch works for me...

But in my opinion, we should also disable panning with one click. It is really confusing for a user to mark a place then immediately pan to another place.

I disabled this option by erasing following line in locpick.js:

obj.map.panTo(point);

giorgosk’s picture

Status: Needs review » Reviewed & tested by the community

have tested this patch works as expected
would be nice to allow it as a non default option

here is a duplicate issue just for reference #738566: [Usability] Get rid of the annoying autozooming when adding a marker (locpick.js)

wim leers’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

I started that other issue and it's actually better documented than this one and has far less noise. Which is why I didn't find this issue in the first place.

As a module maintainer, I know that I go through the clear/less noisiest issues first, so I'm going to flip it around. I'm marking this one a duplicate of the other. No offense intended, I just want to make sure this patch gets committed ASAP. :)

Please add *nothing* to the other issue, except for confirmations of the working fix, to keep it clean. Thanks! :)

alan d.’s picture

lol. Fair point - but the title does state the issue very clearly. I think the norm is to keep the older issues and rename new ones as duplicate to allow tracking back to the original point of discovery of the error, but each to their own. It will be good to get a contribute patch removed for a few sites, no matter where it comes from!

Cheers