Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

autopan centres clicked marker rather than moving map just enough for infobubble to be visible #12

Open
gigmaps opened this issue Oct 27, 2015 · 2 comments

Comments

@gigmaps
Copy link
Contributor

gigmaps commented Oct 27, 2015

Under the current infobubble.js code the 'autoPan' feature is very basic - simply centering the selected / clicked marker, rather than moving the map just enough to make the infobubble visible.

Compare the following jsfiddles :

  1. Using the standard google.maps.InfoWindow() - http://jsfiddle.net/goredwards/3r7r1zkq/
  2. Using the current infobubble.js code - http://jsfiddle.net/goredwards/v9934fqm/

...you may have to move the map to have the marker near the edge to see the autopan effects.

The part of the code that's problematic is the panToView() function which contains code to
effectively centre the map on the selected pin.

This might be fine for very small maps, but on larger maps is completely unnecessary and frankly has an annoying effect that can't be useful in many circumstances.

Was there a plan to update this part of the code to be more in line with the far superior performance of the standard google.maps.InfoWindow() autoPan feature ?

@gigmaps
Copy link
Contributor Author

gigmaps commented Oct 27, 2015

PR #14 updates infobubble autopan (which really only centres the map on the clicked marker) to bring it inline with (ahead of ?) the standard google.maps.InfoWindow() autopan functionality:

  • map is only panned enough for the infobubble window to be visible with an edge margin - as per
  • adds an autopanMargin option to set the margin between the map edge and the infobubble window (with default = 10px)

see updated code working here: http://jsfiddle.net/goredwards/2cs4puaz/
...feel free to modify the autopanMargin: 15 option in the infobubble definition to see how the margin works (you can even put a -ve margin)

@techieshark
Copy link

I know that this repository is unmaintained but autopanMargin seems like a very useful option -
does anyone know if there are plans to incorporate such an option in the main Google Maps InfoWindowOptions object?

I'm seeing an excessive amount of left margin and would love to be able to minimize that:

image

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants