Skip to content

Commit 708dc76

Browse files
authored
Merge pull request allenhwkim#737 from paulmaclean/master
Custom Marker Directive - return from setPosition
2 parents dd72478 + 54ab2a6 commit 708dc76

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

directives/custom-marker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@
7171
if (this.getProjection() && typeof this.position.lng == 'function') {
7272
console.log(_this.getProjection());
7373
var setPosition = function() {
74+
if (!_this.getProjection()) { return; }
7475
var posPixel = _this.getProjection().fromLatLngToDivPixel(_this.position);
7576
var x = Math.round(posPixel.x - (_this.el.offsetWidth/2));
7677
var y = Math.round(posPixel.y - _this.el.offsetHeight - 10); // 10px for anchor
7778
_this.el.style.left = x + "px";
7879
_this.el.style.top = y + "px";
7980
_this.el.style.visibility = "visible";
8081
};
81-
if (_this.el.offsetWidth && _this.el.offsetHeight) {
82+
if (_this.el.offsetWidth && _this.el.offsetHeight) {
8283
setPosition();
8384
} else {
8485
//delayed left/top calculation when width/height are not set instantly

0 commit comments

Comments
 (0)