Skip to content

Commit ca23e7b

Browse files
committed
1 parent d1f362b commit ca23e7b

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

dist/angular-google-maps.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -877,13 +877,8 @@ Nicholas McCready - https://twitter.com/nmccready
877877
return remove.push(addEvent(target, key, _handler));
878878
});
879879
return function() {
880-
angular.forEach(remove, function(fn) {
881-
if (_.isFunction(fn)) {
882-
fn();
883-
}
884-
if (fn.e !== null && _.isFunction(fn.e)) {
885-
return fn.e();
886-
}
880+
angular.forEach(remove, function(listener) {
881+
return google.maps.event.removeListener(listener);
887882
});
888883
return remove = null;
889884
};
@@ -3186,7 +3181,7 @@ Nicholas McCready - https://twitter.com/nmccready
31863181
return;
31873182
}
31883183
return $timeout(function() {
3189-
var arraySyncer, buildOpts, map, polygon;
3184+
var arraySyncer, buildOpts, map, pathPoints, polygon;
31903185
buildOpts = function(pathPoints) {
31913186
var opts;
31923187
opts = angular.extend({}, DEFAULTS, {
@@ -3214,7 +3209,8 @@ Nicholas McCready - https://twitter.com/nmccready
32143209
return opts;
32153210
};
32163211
map = mapCtrl.getMap();
3217-
polygon = new google.maps.Polygon(buildOpts(convertPathPoints(scope.path)));
3212+
pathPoints = convertPathPoints(scope.path);
3213+
polygon = new google.maps.Polygon(buildOpts(pathPoints));
32183214
if (isTrue(attrs.fit)) {
32193215
extendMapBounds(map, pathPoints);
32203216
}
@@ -3246,6 +3242,11 @@ Nicholas McCready - https://twitter.com/nmccready
32463242
}
32473243
});
32483244
}
3245+
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.opacity)) {
3246+
scope.$watch("stroke.opacity", function(newValue, oldValue) {
3247+
return polygon.setOptions(buildOpts(polygon.getPath()));
3248+
});
3249+
}
32493250
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.weight)) {
32503251
scope.$watch("stroke.weight", function(newValue, oldValue) {
32513252
if (newValue !== oldValue) {
@@ -3387,7 +3388,7 @@ Nicholas McCready - https://twitter.com/nmccready
33873388
return;
33883389
}
33893390
return $timeout(function() {
3390-
var arraySyncer, buildOpts, map, polyline;
3391+
var arraySyncer, buildOpts, map, pathPoints, polyline;
33913392
buildOpts = function(pathPoints) {
33923393
var opts;
33933394
opts = angular.extend({}, DEFAULTS, {
@@ -3413,7 +3414,8 @@ Nicholas McCready - https://twitter.com/nmccready
34133414
return opts;
34143415
};
34153416
map = mapCtrl.getMap();
3416-
polyline = new google.maps.Polyline(buildOpts(convertPathPoints(scope.path)));
3417+
pathPoints = convertPathPoints(scope.path);
3418+
polyline = new google.maps.Polyline(buildOpts(pathPoints));
34173419
if (isTrue(attrs.fit)) {
34183420
extendMapBounds(map, pathPoints);
34193421
}

dist/angular-google-maps.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/coffee/directives/polygon.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ angular.module("google-maps")
113113

114114
opts
115115
map = mapCtrl.getMap()
116-
polygon = new google.maps.Polygon(buildOpts(convertPathPoints(scope.path)))
116+
pathPoints = convertPathPoints(scope.path)
117+
polygon = new google.maps.Polygon(buildOpts(pathPoints))
117118
extendMapBounds map, pathPoints if isTrue(attrs.fit)
118119
if angular.isDefined(scope.editable)
119120
scope.$watch "editable", (newValue, oldValue) ->

src/coffee/directives/polyline.coffee

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ angular.module("google-maps")
110110

111111
opts
112112
map = mapCtrl.getMap()
113-
polyline = new google.maps.Polyline(buildOpts(convertPathPoints(scope.path)))
113+
pathPoints = convertPathPoints(scope.path)
114+
polyline = new google.maps.Polyline(buildOpts(pathPoints))
114115
extendMapBounds map, pathPoints if isTrue(attrs.fit)
115116
if angular.isDefined(scope.editable)
116117
scope.$watch "editable", (newValue, oldValue) ->
@@ -146,4 +147,4 @@ angular.module("google-maps")
146147
arraySyncer = null
147148

148149

149-
]
150+
]

0 commit comments

Comments
 (0)