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

Commit e5f287f

Browse files
committed
Merge branch 'feature/issue_113' into r1-dev
2 parents d61c9ff + 1d41c39 commit e5f287f

11 files changed

+63
-43
lines changed

dist/angular-google-maps.js

+27-23
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
}
@@ -1001,22 +1004,24 @@
10011004
this.onDestroy = __bind(this.onDestroy, this);
10021005
this.onWatch = __bind(this.onWatch, this);
10031006
this.validateScope = __bind(this.validateScope, this);
1004-
var opts, self,
1007+
var self,
10051008
_this = this;
10061009
MarkerParentModel.__super__.constructor.call(this, scope, element, attrs, mapCtrl, $timeout);
10071010
self = this;
1008-
opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options, mapCtrl.getMap());
1009-
this.gMarker = new google.maps.Marker(opts);
1010-
element.data('instance', this.gMarker);
1011-
this.scope = scope;
1012-
google.maps.event.addListener(this.gMarker, 'click', function() {
1013-
if (_this.doClick && (scope.click != null)) {
1014-
return $timeout(function() {
1015-
return _this.scope.click();
1016-
});
1017-
}
1018-
});
1019-
this.$log.info(this);
1011+
$timeout(function() {
1012+
var opts;
1013+
opts = _this.createMarkerOptions(_this.scope.coords, _this.scope.icon, _this.scope.options, _this.mapCtrl.getMap());
1014+
_this.gMarker = new google.maps.Marker(opts);
1015+
_this.element.data('instance', _this.gMarker);
1016+
google.maps.event.addListener(_this.gMarker, 'click', function() {
1017+
if (_this.doClick && (scope.click != null)) {
1018+
return $timeout(function() {
1019+
return _this.scope.click();
1020+
});
1021+
}
1022+
});
1023+
return _this.$log.info(_this);
1024+
}, directives.api.utils.GmapUtil.defaultDelay);
10201025
}
10211026

10221027
MarkerParentModel.prototype.validateScope = function(scope) {
@@ -1096,6 +1101,7 @@
10961101
this.gMarkerManager = void 0;
10971102
this.scope = scope;
10981103
this.bigGulp = directives.api.utils.AsyncProcessor;
1104+
this.$timeout = $timeout;
10991105
this.$log.info(this);
11001106
}
11011107

@@ -1507,13 +1513,11 @@
15071513
};
15081514
}
15091515

1510-
IMarker.prototype.controller = {
1511-
controller: [
1512-
'$scope', '$element', function($scope, $element) {
1513-
throw new Exception("Not Implemented!!");
1514-
}
1515-
]
1516-
};
1516+
IMarker.prototype.controller = [
1517+
'$scope', '$element', function($scope, $element) {
1518+
throw new Exception("Not Implemented!!");
1519+
}
1520+
];
15171521

15181522
IMarker.prototype.link = function(scope, element, attrs, ctrl) {
15191523
throw new Exception("Not implemented!!");
@@ -1612,7 +1616,7 @@
16121616
return scope.$on("$destroy", function() {
16131617
return label.destroy();
16141618
});
1615-
}, 50);
1619+
}, directives.api.utils.GmapUtil.defaultDelay + 25);
16161620
};
16171621

16181622
return Label;
@@ -1762,7 +1766,7 @@ not 1:1 in this setting.
17621766
return scope.$on("$destroy", function() {
17631767
return window.destroy();
17641768
});
1765-
}, 50);
1769+
}, directives.api.utils.GmapUtil.defaultDelay + 25);
17661770
};
17671771

17681772
return Window;

dist/angular-google-maps.min.js

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

example/example-controller.js

+8
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,17 @@ function ExampleController ($scope, $timeout, $log) {
230230
genRandomMarkers(numberOfMarkers,$scope);
231231
}
232232

233+
$scope.searchLocation = {
234+
latitude: 30.1451,
235+
longitude: -99.6680
236+
};
233237
$scope.onMarkerClicked = onMarkerClicked
234238

235239
$timeout(function () {
240+
// $scope.searchLocation = {
241+
// latitude: 30.0,
242+
// longitude: -100
243+
// };
236244
$scope.map.infoWindow.show = true;
237245
dynamicMarkers = [
238246
{

example/example.html

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ <h1>angular-google-maps example</h1>
7979

8080
<trafficlayer show="map.showTraffic" />
8181

82+
<marker coords="searchLocation">
83+
</marker>
8284
<markers models="map.randomMarkers" coords="'self'" icon="'icon'" click="'onClicked'" doCluster="true">
8385
</markers>
8486

src/coffee/directives/api/i-marker.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
click: '&click',
2424
options: '=options'
2525
}
26-
controller: controller: ['$scope','$element', ($scope, $element) ->
26+
controller: ['$scope','$element', ($scope, $element) ->
2727
throw new Exception("Not Implemented!!")
2828
]
2929
link: (scope, element, attrs, ctrl) =>

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

+13-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
constructor: (scope, element, attrs, mapCtrl,$timeout) ->
99
super(scope, element, attrs, mapCtrl,$timeout)
1010
self = @
11-
opts = @createMarkerOptions(scope.coords,scope.icon,scope.options,mapCtrl.getMap())
12-
#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)
13-
@gMarker = new google.maps.Marker(opts)
14-
element.data('instance', @gMarker)
15-
@scope = scope
16-
google.maps.event.addListener(@gMarker, 'click', =>
17-
if @doClick and scope.click?
18-
$timeout( =>
19-
@scope.click()
20-
)
21-
)
22-
@$log.info(@)
11+
$timeout( =>
12+
opts = @createMarkerOptions(@scope.coords,@scope.icon,@scope.options,@mapCtrl.getMap())
13+
#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)
14+
@gMarker = new google.maps.Marker(opts)
15+
@element.data('instance', @gMarker)
16+
google.maps.event.addListener(@gMarker, 'click', =>
17+
if @doClick and scope.click?
18+
$timeout( =>
19+
@scope.click()
20+
)
21+
)
22+
@$log.info(@)
23+
,directives.api.utils.GmapUtil.defaultDelay)
2324

2425
validateScope:(scope)=>
2526
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)