Skip to content

Commit a1c2a9d

Browse files
committed
version bump
2 parents c16a038 + 5fca355 commit a1c2a9d

File tree

15 files changed

+366
-96
lines changed

15 files changed

+366
-96
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: node_js
22
node_js:
33
- "0.11"
44
- "0.10"
5-
- "0.8"
65
before_script: PATH="$(npm bin):$PATH" bower install
76
script: grunt
87
branches:

Gruntfile.coffee

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ module.exports = (grunt) ->
1515
grunt.loadNpmTasks "grunt-contrib-jasmine"
1616
grunt.loadNpmTasks "grunt-conventional-changelog"
1717

18-
# Project configuration.
19-
grunt.initConfig
18+
options =
19+
# Project configuration.
2020
pkg: grunt.file.readJSON("package.json")
2121
clean:
2222
coffee: ["tmp/output_coffee.js", "tmp"]
@@ -127,10 +127,10 @@ module.exports = (grunt) ->
127127

128128
twomaps:
129129
path: "http://localhost:3100/example/two-maps.html"
130-
130+
131131
geojson:
132132
path: "http://localhost:3100/example/geojson.html"
133-
133+
134134
hugedata:
135135
path: "http://localhost:3100/example/hugedata.html"
136136

@@ -158,7 +158,10 @@ module.exports = (grunt) ->
158158

159159
jasmine:
160160
spec: jasmineSettings.spec
161-
coverage: jasmineSettings.coverage
161+
162+
options.jasmine.coverage = jasmineSettings.coverage if jasmineSettings.coverage
163+
grunt.initConfig options
164+
162165

163166
# Default task: build a release in dist/
164167
grunt.registerTask "default", ["clean:dist", "jshint", "mkdir", "coffee", "concat:dist", "copy:dist",

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-google-maps",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"main": "./dist/angular-google-maps.js",
55
"dependencies": {
66
"angular": "1.2.x",

dist/angular-google-maps.js

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 1.1.0 2014-05-31
1+
/*! angular-google-maps 1.1.1 2014-06-11
22
* AngularJS directives for Google Maps
33
* git: https://github.com/nlaplante/angular-google-maps.git
44
*/
@@ -438,10 +438,9 @@ Nicholas McCready - https://twitter.com/nmccready
438438
if (coords.type === "Point" && _.isArray(coords.coordinates) && coords.coordinates.length === 2) {
439439
return true;
440440
}
441-
} else {
442-
if (coords && angular.isDefined((coords != null ? coords.latitude : void 0) && angular.isDefined(coords != null ? coords.longitude : void 0))) {
443-
return true;
444-
}
441+
}
442+
if (coords && angular.isDefined((coords != null ? coords.latitude : void 0) && angular.isDefined(coords != null ? coords.longitude : void 0))) {
443+
return true;
445444
}
446445
return false;
447446
};
@@ -519,7 +518,7 @@ Nicholas McCready - https://twitter.com/nmccready
519518
getCoords: getCoords,
520519
validateCoords: validateCoords,
521520
validatePath: function(path) {
522-
var array, i;
521+
var array, i, polygon, trackMaxVertices;
523522
i = 0;
524523
if (angular.isUndefined(path.type)) {
525524
if (!Array.isArray(path) || path.length < 2) {
@@ -541,6 +540,22 @@ Nicholas McCready - https://twitter.com/nmccready
541540
return false;
542541
}
543542
array = path.coordinates[0];
543+
} else if (path.type === "MultiPolygon") {
544+
trackMaxVertices = {
545+
max: 0,
546+
index: 0
547+
};
548+
_.forEach(path.coordinates, function(polygon, index) {
549+
if (polygon[0].length > this.max) {
550+
this.max = polygon[0].length;
551+
return this.index = index;
552+
}
553+
}, trackMaxVertices);
554+
polygon = path.coordinates[trackMaxVertices.index];
555+
array = polygon[0];
556+
if (array.length < 4) {
557+
return false;
558+
}
544559
} else if (path.type === "LineString") {
545560
if (path.coordinates.length < 2) {
546561
return false;
@@ -559,7 +574,7 @@ Nicholas McCready - https://twitter.com/nmccready
559574
}
560575
},
561576
convertPathPoints: function(path) {
562-
var array, i, latlng, result;
577+
var array, i, latlng, result, trackMaxVertices;
563578
i = 0;
564579
result = new google.maps.MVCArray();
565580
if (angular.isUndefined(path.type)) {
@@ -577,6 +592,18 @@ Nicholas McCready - https://twitter.com/nmccready
577592
array;
578593
if (path.type === "Polygon") {
579594
array = path.coordinates[0];
595+
} else if (path.type === "MultiPolygon") {
596+
trackMaxVertices = {
597+
max: 0,
598+
index: 0
599+
};
600+
_.forEach(path.coordinates, function(polygon, index) {
601+
if (polygon[0].length > this.max) {
602+
this.max = polygon[0].length;
603+
return this.index = index;
604+
}
605+
}, trackMaxVertices);
606+
array = path.coordinates[trackMaxVertices.index][0];
580607
} else if (path.type === "LineString") {
581608
array = path.coordinates;
582609
}
@@ -1120,7 +1147,7 @@ Nicholas McCready - https://twitter.com/nmccready
11201147
(function() {
11211148
angular.module("google-maps").factory("array-sync", [
11221149
"add-events", function(mapEvents) {
1123-
return function(mapArray, scope, pathEval) {
1150+
return function(mapArray, scope, pathEval, pathChangedFn) {
11241151
var geojsonArray, geojsonHandlers, geojsonWatcher, isSetFromScope, legacyHandlers, legacyWatcher, mapArrayListener, scopePath, watchListener;
11251152
isSetFromScope = false;
11261153
scopePath = scope.$eval(pathEval);
@@ -1293,7 +1320,7 @@ Nicholas McCready - https://twitter.com/nmccready
12931320
if (angular.isUndefined(scopePath.type)) {
12941321
watchListener = scope.$watchCollection(pathEval, legacyWatcher);
12951322
} else {
1296-
watchListener = scope.$watch(pathEval, geojsonWatcher);
1323+
watchListener = scope.$watch(pathEval, geojsonWatcher, true);
12971324
}
12981325
}
12991326
return function() {
@@ -1710,15 +1737,14 @@ Nicholas McCready - https://twitter.com/nmccready
17101737
PolylineChildModel.include(GmapUtil);
17111738

17121739
function PolylineChildModel(scope, attrs, map, defaults, model) {
1713-
var arraySyncer, pathPoints, self,
1740+
var arraySyncer, pathPoints,
17141741
_this = this;
17151742
this.scope = scope;
17161743
this.attrs = attrs;
17171744
this.map = map;
17181745
this.defaults = defaults;
17191746
this.model = model;
17201747
this.buildOpts = __bind(this.buildOpts, this);
1721-
self = this;
17221748
pathPoints = this.convertPathPoints(this.scope.path);
17231749
this.polyline = new google.maps.Polyline(this.buildOpts(pathPoints));
17241750
if (this.isTrue(this.attrs.fit)) {
@@ -1727,49 +1753,56 @@ Nicholas McCready - https://twitter.com/nmccready
17271753
if (!scope["static"] && angular.isDefined(scope.editable)) {
17281754
scope.$watch("editable", function(newValue, oldValue) {
17291755
if (newValue !== oldValue) {
1730-
return this.polyline.setEditable(newValue);
1756+
return _this.polyline.setEditable(newValue);
17311757
}
17321758
});
17331759
}
17341760
if (angular.isDefined(scope.draggable)) {
17351761
scope.$watch("draggable", function(newValue, oldValue) {
17361762
if (newValue !== oldValue) {
1737-
return this.polyline.setDraggable(newValue);
1763+
return _this.polyline.setDraggable(newValue);
17381764
}
17391765
});
17401766
}
17411767
if (angular.isDefined(scope.visible)) {
17421768
scope.$watch("visible", function(newValue, oldValue) {
17431769
if (newValue !== oldValue) {
1744-
return this.polyline.setVisible(newValue);
1770+
return _this.polyline.setVisible(newValue);
17451771
}
17461772
});
17471773
}
17481774
if (angular.isDefined(scope.geodesic)) {
17491775
scope.$watch("geodesic", function(newValue, oldValue) {
17501776
if (newValue !== oldValue) {
1751-
return this.polyline.setOptions(this.buildOpts(this.polyline.getPath()));
1777+
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
17521778
}
17531779
});
17541780
}
17551781
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.weight)) {
17561782
scope.$watch("stroke.weight", function(newValue, oldValue) {
17571783
if (newValue !== oldValue) {
1758-
return this.polyline.setOptions(this.buildOpts(this.polyline.getPath()));
1784+
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
17591785
}
17601786
});
17611787
}
17621788
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.color)) {
17631789
scope.$watch("stroke.color", function(newValue, oldValue) {
17641790
if (newValue !== oldValue) {
1765-
return this.polyline.setOptions(this.buildOpts(this.polyline.getPath()));
1791+
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
1792+
}
1793+
});
1794+
}
1795+
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.opacity)) {
1796+
scope.$watch("stroke.opacity", function(newValue, oldValue) {
1797+
if (newValue !== oldValue) {
1798+
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
17661799
}
17671800
});
17681801
}
17691802
if (angular.isDefined(scope.icons)) {
17701803
scope.$watch("icons", function(newValue, oldValue) {
17711804
if (newValue !== oldValue) {
1772-
return this.polyline.setOptions(this.buildOpts(this.polyline.getPath()));
1805+
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
17731806
}
17741807
});
17751808
}
@@ -3626,7 +3659,7 @@ Nicholas McCready - https://twitter.com/nmccready
36263659
scope.$watch("center", (function(newValue, oldValue) {
36273660
var coords;
36283661
coords = _this.getCoords(newValue);
3629-
if (newValue === oldValue || (coords.lat() === _m.center.lat() && coords.lng() === _m.center.lng())) {
3662+
if (coords.lat() === _m.center.lat() && coords.lng() === _m.center.lng()) {
36303663
return;
36313664
}
36323665
settingCenterFromScope = true;
@@ -3643,7 +3676,7 @@ Nicholas McCready - https://twitter.com/nmccready
36433676
return settingCenterFromScope = false;
36443677
}), true);
36453678
scope.$watch("zoom", function(newValue, oldValue) {
3646-
if (newValue === oldValue || newValue === _m.zoom) {
3679+
if (newValue === _m.zoom) {
36473680
return;
36483681
}
36493682
return _.defer(function() {
@@ -4284,15 +4317,16 @@ Rick Huizinga - https://plus.google.com/+RickHuizinga
42844317
visible: "=",
42854318
"static": "=",
42864319
events: "=",
4287-
zIndex: "=zindex"
4320+
zIndex: "=zindex",
4321+
fit: "="
42884322
},
42894323
link: function(scope, element, attrs, mapCtrl) {
42904324
if (angular.isUndefined(scope.path) || scope.path === null || !GmapUtil.validatePath(scope.path)) {
42914325
$log.error("polygon: no valid path attribute found");
42924326
return;
42934327
}
42944328
return $timeout(function() {
4295-
var arraySyncer, buildOpts, eventName, getEventHandler, map, polygon;
4329+
var arraySyncer, buildOpts, eventName, getEventHandler, map, pathPoints, polygon;
42964330
buildOpts = function(pathPoints) {
42974331
var opts;
42984332
opts = angular.extend({}, DEFAULTS, {
@@ -4311,6 +4345,7 @@ Rick Huizinga - https://plus.google.com/+RickHuizinga
43114345
geodesic: false,
43124346
visible: true,
43134347
"static": false,
4348+
fit: false,
43144349
zIndex: 0
43154350
}, function(defaultValue, key) {
43164351
if (angular.isUndefined(scope[key]) || scope[key] === null) {
@@ -4325,8 +4360,9 @@ Rick Huizinga - https://plus.google.com/+RickHuizinga
43254360
return opts;
43264361
};
43274362
map = mapCtrl.getMap();
4328-
polygon = new google.maps.Polygon(buildOpts(GmapUtil.convertPathPoints(scope.path)));
4329-
if (isTrue(attrs.fit)) {
4363+
pathPoints = GmapUtil.convertPathPoints(scope.path);
4364+
polygon = new google.maps.Polygon(buildOpts(pathPoints));
4365+
if (scope.fit) {
43304366
GmapUtil.extendMapBounds(map, pathPoints);
43314367
}
43324368
if (!scope["static"] && angular.isDefined(scope.editable)) {
@@ -4409,7 +4445,11 @@ Rick Huizinga - https://plus.google.com/+RickHuizinga
44094445
}
44104446
}
44114447
}
4412-
arraySyncer = arraySync(polygon.getPath(), scope, "path");
4448+
arraySyncer = arraySync(polygon.getPath(), scope, "path", function(pathPoints) {
4449+
if (scope.fit) {
4450+
return GmapUtil.extendMapBounds(map, pathPoints);
4451+
}
4452+
});
44134453
return scope.$on("$destroy", function() {
44144454
polygon.setMap(null);
44154455
if (arraySyncer) {

dist/angular-google-maps.min.js

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

0 commit comments

Comments
 (0)