File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -235,13 +235,14 @@ <h1 class="title">
235235 var posPixel = this.getProjection().fromLatLngToDivPixel(this.position);
236236 //delayed left/top calculation. with/height are not set instantly
237237 var _this = this;
238+ var delay = _this.el.offsetWidth ? 0 : 300;
238239 $timeout(function() {
239240 var x = Math.round(posPixel.x - (_this.el.offsetWidth/2));
240241 var y = Math.round(posPixel.y - _this.el.offsetHeight - 10); // 10px for anchor
241242 _this.el.style.left = x + "px";
242243 _this.el.style.top = y + "px";
243244 _this.el.style.visibility = "visible";
244- }, 300 );
245+ }, delay );
245246 }
246247 };
247248 CustomMarker.prototype.setZIndex = function(zIndex) {
Original file line number Diff line number Diff line change @@ -456,17 +456,19 @@ angular.module('ngMap').config([
456456
457457 CustomMarker . prototype . setPosition = function ( position ) {
458458 position && ( this . position = position ) ; /* jshint ignore:line */
459+
459460 if ( this . getProjection ( ) && typeof this . position . lng == 'function' ) {
460461 var posPixel = this . getProjection ( ) . fromLatLngToDivPixel ( this . position ) ;
461462 //delayed left/top calculation. with/height are not set instantly
462463 var _this = this ;
464+ var delay = _this . el . offsetWidth ? 0 : 300 ;
463465 $timeout ( function ( ) {
464466 var x = Math . round ( posPixel . x - ( _this . el . offsetWidth / 2 ) ) ;
465467 var y = Math . round ( posPixel . y - _this . el . offsetHeight - 10 ) ; // 10px for anchor
466468 _this . el . style . left = x + "px" ;
467469 _this . el . style . top = y + "px" ;
468470 _this . el . style . visibility = "visible" ;
469- } , 300 ) ;
471+ } , delay ) ;
470472 }
471473 } ;
472474
Original file line number Diff line number Diff line change @@ -456,17 +456,19 @@ angular.module('ngMap').config([
456456
457457 CustomMarker . prototype . setPosition = function ( position ) {
458458 position && ( this . position = position ) ; /* jshint ignore:line */
459+
459460 if ( this . getProjection ( ) && typeof this . position . lng == 'function' ) {
460461 var posPixel = this . getProjection ( ) . fromLatLngToDivPixel ( this . position ) ;
461462 //delayed left/top calculation. with/height are not set instantly
462463 var _this = this ;
464+ var delay = _this . el . offsetWidth ? 0 : 300 ;
463465 $timeout ( function ( ) {
464466 var x = Math . round ( posPixel . x - ( _this . el . offsetWidth / 2 ) ) ;
465467 var y = Math . round ( posPixel . y - _this . el . offsetHeight - 10 ) ; // 10px for anchor
466468 _this . el . style . left = x + "px" ;
467469 _this . el . style . top = y + "px" ;
468470 _this . el . style . visibility = "visible" ;
469- } , 300 ) ;
471+ } , delay ) ;
470472 }
471473 } ;
472474
You can’t perform that action at this time.
0 commit comments