-
Notifications
You must be signed in to change notification settings - Fork 182
update the infobubble autopan functionality: #14
base: gh-pages
Are you sure you want to change the base?
Conversation
- 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
this updates the autopan functionality to bring it inline with (ahead of ?) the standard
google.maps.InfoWindow()
autopan:infobubble
window to be visible with an edge margin - as perautopanMargin
option to set the margin between the map edge and the infobubble window (with default = 10px)panToView()
functionremove comment about the use of
anchorPoint
being a hack - sincepixelBounds
has been deprecated