Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Commit 1d41c39

Browse files
committed
daisy chain the timeouts.. ie marker first, then window and markerlabel
1 parent 23c3d30 commit 1d41c39

8 files changed

+24
-17
lines changed

dist/angular-google-maps.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@
376376
content: content,
377377
position: angular.isObject(gMarker) ? gMarker.getPosition() : new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude)
378378
});
379-
}
379+
},
380+
defaultDelay: 50
380381
};
381382
});
382383

@@ -883,6 +884,8 @@
883884
var self,
884885
_this = this;
885886
self = this;
887+
this.scope = scope;
888+
this.element = element;
886889
if (this.validateScope(scope)) {
887890
return;
888891
}
@@ -1007,10 +1010,9 @@
10071010
self = this;
10081011
$timeout(function() {
10091012
var opts;
1010-
opts = _this.createMarkerOptions(scope.coords, scope.icon, scope.options, mapCtrl.getMap());
1013+
opts = _this.createMarkerOptions(_this.scope.coords, _this.scope.icon, _this.scope.options, _this.mapCtrl.getMap());
10111014
_this.gMarker = new google.maps.Marker(opts);
1012-
element.data('instance', _this.gMarker);
1013-
_this.scope = scope;
1015+
_this.element.data('instance', _this.gMarker);
10141016
google.maps.event.addListener(_this.gMarker, 'click', function() {
10151017
if (_this.doClick && (scope.click != null)) {
10161018
return $timeout(function() {
@@ -1019,7 +1021,7 @@
10191021
}
10201022
});
10211023
return _this.$log.info(_this);
1022-
});
1024+
}, directives.api.utils.GmapUtil.defaultDelay);
10231025
}
10241026

10251027
MarkerParentModel.prototype.validateScope = function(scope) {
@@ -1099,6 +1101,7 @@
10991101
this.gMarkerManager = void 0;
11001102
this.scope = scope;
11011103
this.bigGulp = directives.api.utils.AsyncProcessor;
1104+
this.$timeout = $timeout;
11021105
this.$log.info(this);
11031106
}
11041107

@@ -1613,7 +1616,7 @@
16131616
return scope.$on("$destroy", function() {
16141617
return label.destroy();
16151618
});
1616-
}, 50);
1619+
}, directives.api.utils.GmapUtil.defaultDelay + 25);
16171620
};
16181621

16191622
return Label;
@@ -1763,7 +1766,7 @@ not 1:1 in this setting.
17631766
return scope.$on("$destroy", function() {
17641767
return window.destroy();
17651768
});
1766-
}, 50);
1769+
}, directives.api.utils.GmapUtil.defaultDelay + 25);
17671770
};
17681771

17691772
return Window;

dist/angular-google-maps.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/coffee/directives/api/label.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
scope.$on("$destroy", =>
1919
label.destroy()
2020
)
21-
,50)
21+
,directives.api.utils.GmapUtil.defaultDelay + 25)

src/coffee/directives/api/models/parent/i-marker-parent-model.coffee

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
constructor: (scope, element, attrs, mapCtrl,$timeout) ->
2020
self = @
21+
@scope = scope
22+
@element = element
2123
# Validate required properties
2224
if (@validateScope(scope))
2325
return

src/coffee/directives/api/models/parent/marker-parent-model.coffee

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
super(scope, element, attrs, mapCtrl,$timeout)
1010
self = @
1111
$timeout( =>
12-
opts = @createMarkerOptions(scope.coords,scope.icon,scope.options,mapCtrl.getMap())
12+
opts = @createMarkerOptions(@scope.coords,@scope.icon,@scope.options,@mapCtrl.getMap())
1313
#using scope.$id as the identifier for a marker as scope.$id should be unique, no need for an index (as it is the index)
1414
@gMarker = new google.maps.Marker(opts)
15-
element.data('instance', @gMarker)
16-
@scope = scope
15+
@element.data('instance', @gMarker)
1716
google.maps.event.addListener(@gMarker, 'click', =>
1817
if @doClick and scope.click?
1918
$timeout( =>
2019
@scope.click()
2120
)
2221
)
2322
@$log.info(@)
24-
)
23+
,directives.api.utils.GmapUtil.defaultDelay)
2524

2625
validateScope:(scope)=>
2726
super(scope) or angular.isUndefined(scope.coords.latitude) or angular.isUndefined(scope.coords.longitude)

src/coffee/directives/api/models/parent/markers-parent-model.coffee

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@gMarkerManager = undefined
99
@scope = scope
1010
@bigGulp = directives.api.utils.AsyncProcessor
11+
@$timeout = $timeout
1112
@$log.info(@)
1213

1314
onTimeOut:(scope)=>

src/coffee/directives/api/utils/gmap-util.coffee

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
gMarker.getPosition()
2525
else
2626
new google.maps.LatLng(scope.coords.latitude, scope.coords.longitude)
27-
})
27+
})
28+
29+
defaultDelay:50

src/coffee/directives/api/window.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
scope.$on("$destroy", =>
3131
window.destroy()
3232
)
33-
,50)
33+
,directives.api.utils.GmapUtil.defaultDelay + 25)

0 commit comments

Comments
 (0)