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

update the infobubble autopan functionality: #14

Open
wants to merge 5 commits into
base: gh-pages
Choose a base branch
from

Conversation

gigmaps
Copy link
Contributor

@gigmaps gigmaps commented Oct 27, 2015

this updates the autopan functionality to bring it inline with (ahead of ?) the standard google.maps.InfoWindow() autopan:

  • so map is only panned enough for the infobubble window to be visible with an edge margin - as per
  • add an autopanMargin option to set the margin between the map edge and the infobubble window (with default = 10px)
  • better variable naming & comments in panToView() function

remove comment about the use of anchorPoint being a hack - since pixelBounds has been deprecated

- so map is only panned enough for the infobubble window to be visible with an edge margin - as per google.maps.InfoWindow()
- add an `autopanMargin` option to set the margin between the map edge and the infobubble window (with default = 10px)
- update variable naming & comments in panToView() function

remove comment about the use of `anchorPoint` being a hack - since `pixelBounds` has been deprecated
- add infobubble `arrowHeight` variable to take into account the (variable) height of the bottom pointer / arrow
- update spaceTop formula and associated comments
var map = this.get('map');
var mapDiv = map.getDiv();
var mapHeight = mapDiv.offsetHeight;
var autopanMargin = this.get('autopanMargin'); // get the edge margin from options (or default)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please follow the same style that already existed.

This is mainly around position of comments and keeping to 80 character line limits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok no worries - comments shifted to line above and line length limited to ~80 char.

- remove comment about the use of `anchorPoint` being a hack - since `pixelBounds` has been deprecated
// centre of the map - pixels
var mapCenter = projection.fromLatLngToContainerPixel(map.getCenter());
// calculate top free space or overrun (incl autopan margin) - pixels
var spaceTop = markerPosition.y - infobubbleHeight - arrowHeight - anchorHeight - autopanMargin;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to keep to the 80 char line length

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

- keep to the 80 char line length
- spaces around '/'
- space between ')' and '{'
- comment indentation 2 spaces instead of 4
- add 'var' to define 'newMapCenterLatLng' as local variable
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants