Created
March 29, 2015 06:07
-
-
Save zpratt/87db98b7ebc36b31a2c2 to your computer and use it in GitHub Desktop.
Custom Overlay - Define draw method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function positionOverlayByDimensions(projectedLatLng) { | |
var offsetHeight = this.el.offsetHeight, | |
offsetWidth = this.el.offsetWidth; | |
this.el.style.top = projectedLatLng.y - offsetHeight + 'px'; | |
this.el.style.left = projectedLatLng.x - Math.floor(offsetWidth / 2) + 'px'; | |
} | |
BaseOverlay.prototype.draw = function () { | |
var projection = this.getProjection(), | |
projectedLatLng = projection.fromLatLngToDivPixel(this.point); | |
positionOverlayByDimensions.call(this, projectedLatLng); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment