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

Commit cf178c8

Browse files
committed
fix(markerspiderfier): Check if spiderfier is on during an event to recreate the spiderfier if the markers are modified.
fix(markerspiderfy): attempting to fix spiderfy on model changes like icon switching when spiderfy is on chore(build): compile all
1 parent 1f35166 commit cf178c8

15 files changed

+278
-73
lines changed

Gruntfile.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,6 @@ module.exports = (grunt) ->
132132

133133
grunt.registerTask 'allExamples', allExamplesTaskToRun
134134

135-
135+
grunt.registerTask 'server', ["connect:server", "watch:all"]
136+
grunt.registerTask 's', 'server'
136137
#to see all tasks available don't forget "grunt --help" !!!

dist/angular-google-maps-street-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 2.1.5 2015-08-17
1+
/*! angular-google-maps 2.1.5 2015-08-23
22
* AngularJS directives for Google Maps
33
* git: https://github.com/angular-ui/angular-google-maps.git
44
*/

dist/angular-google-maps-street-view.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps-street-view_dev_mapped.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps-street-view_dev_mapped.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps.js

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 2.1.5 2015-08-17
1+
/*! angular-google-maps 2.1.5 2015-08-23
22
* AngularJS directives for Google Maps
33
* git: https://github.com/angular-ui/angular-google-maps.git
44
*/
@@ -2147,6 +2147,7 @@ Nicholas McCready - https://twitter.com/nmccready
21472147
this.opt_events = opt_events;
21482148
this.scope = scope;
21492149
this.checkSync = bind(this.checkSync, this);
2150+
this.isSpiderfied = bind(this.isSpiderfied, this);
21502151
this.getGMarkers = bind(this.getGMarkers, this);
21512152
this.fit = bind(this.fit, this);
21522153
this.destroy = bind(this.destroy, this);
@@ -2159,7 +2160,7 @@ Nicholas McCready - https://twitter.com/nmccready
21592160
this.update = bind(this.update, this);
21602161
this.add = bind(this.add, this);
21612162
this.type = SpiderfierMarkerManager.type;
2162-
this.clusterer = new MarkerSpiderfier(gMap, this.opt_options);
2163+
this.markerSpiderfier = new MarkerSpiderfier(gMap, this.opt_options);
21632164
this.propMapGMarkers = new PropMap();
21642165
this.attachEvents(this.opt_events, 'opt_events');
21652166
this.noDrawOnSingleAddRemoves = true;
@@ -2175,9 +2176,9 @@ Nicholas McCready - https://twitter.com/nmccready
21752176
};
21762177

21772178
SpiderfierMarkerManager.prototype.add = function(gMarker) {
2178-
gMarker.setMap(this.clusterer.map);
2179+
gMarker.setMap(this.markerSpiderfier.map);
21792180
this.checkKey(gMarker);
2180-
this.clusterer.addMarker(gMarker, this.noDrawOnSingleAddRemoves);
2181+
this.markerSpiderfier.addMarker(gMarker, this.noDrawOnSingleAddRemoves);
21812182
this.propMapGMarkers.put(gMarker.key, gMarker);
21822183
return this.checkSync();
21832184
};
@@ -2201,7 +2202,7 @@ Nicholas McCready - https://twitter.com/nmccready
22012202
exists = this.propMapGMarkers.get(gMarker.key);
22022203
if (exists) {
22032204
gMarker.setMap(null);
2204-
this.clusterer.removeMarker(gMarker, this.noDrawOnSingleAddRemoves);
2205+
this.markerSpiderfier.removeMarker(gMarker, this.noDrawOnSingleAddRemoves);
22052206
this.propMapGMarkers.remove(gMarker.key);
22062207
}
22072208
return this.checkSync();
@@ -2226,8 +2227,8 @@ Nicholas McCready - https://twitter.com/nmccready
22262227
return _.each(options, (function(_this) {
22272228
return function(eventHandler, eventName) {
22282229
if (options.hasOwnProperty(eventName) && angular.isFunction(options[eventName])) {
2229-
$log.info(optionsName + ": Attaching event: " + eventName + " to clusterer");
2230-
return _this.clusterer.addListener(eventName, function() {
2230+
$log.info(optionsName + ": Attaching event: " + eventName + " to markerSpiderfier");
2231+
return _this.markerSpiderfier.addListener(eventName, function() {
22312232
if (eventName === 'spiderfy' || eventName === 'unspiderfy') {
22322233
return _this.scope.$evalAsync(options[eventName].apply(options, arguments));
22332234
} else {
@@ -2247,8 +2248,8 @@ Nicholas McCready - https://twitter.com/nmccready
22472248
for (eventName in options) {
22482249
eventHandler = options[eventName];
22492250
if (options.hasOwnProperty(eventName) && angular.isFunction(options[eventName])) {
2250-
$log.info(optionsName + ": Clearing event: " + eventName + " to clusterer");
2251-
results.push(this.clusterer.clearListeners(eventName));
2251+
$log.info(optionsName + ": Clearing event: " + eventName + " to markerSpiderfier");
2252+
results.push(this.markerSpiderfier.clearListeners(eventName));
22522253
} else {
22532254
results.push(void 0);
22542255
}
@@ -2263,11 +2264,17 @@ Nicholas McCready - https://twitter.com/nmccready
22632264
};
22642265

22652266
SpiderfierMarkerManager.prototype.fit = function() {
2266-
return FitHelper.fit(this.getGMarkers(), this.clusterer.map);
2267+
return FitHelper.fit(this.getGMarkers(), this.markerSpiderfier.map);
22672268
};
22682269

22692270
SpiderfierMarkerManager.prototype.getGMarkers = function() {
2270-
return this.clusterer.getMarkers();
2271+
return this.markerSpiderfier.getMarkers();
2272+
};
2273+
2274+
SpiderfierMarkerManager.prototype.isSpiderfied = function() {
2275+
return _.find(this.getGMarkers(), function(gMarker) {
2276+
return (gMarker != null ? gMarker._omsData : void 0) != null;
2277+
});
22712278
};
22722279

22732280
SpiderfierMarkerManager.prototype.checkSync = function() {};
@@ -3278,11 +3285,14 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
32783285
};
32793286

32803287
MarkerChildModel.prototype.renderGMarker = function(doDraw, validCb) {
3281-
var coords;
3288+
var coords, isSpiderfied, ref;
32823289
if (doDraw == null) {
32833290
doDraw = true;
32843291
}
32853292
coords = this.getProp('coords', this.scope, this.model);
3293+
if (((ref = this.gManager) != null ? ref.isSpiderfied : void 0) != null) {
3294+
isSpiderfied = this.gManager.isSpiderfied();
3295+
}
32863296
if (coords != null) {
32873297
if (!this.validateCoords(coords)) {
32883298
$log.debug('MarkerChild does not have coords yet. They may be defined later.');
@@ -3292,7 +3302,10 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
32923302
validCb();
32933303
}
32943304
if (doDraw && this.gObject) {
3295-
return this.gManager.add(this.gObject);
3305+
this.gManager.add(this.gObject);
3306+
}
3307+
if (isSpiderfied) {
3308+
return this.gManager.markerSpiderfier.spiderListener(this.gObject, window.event);
32963309
}
32973310
} else {
32983311
if (doDraw && this.gObject) {
@@ -4832,8 +4845,11 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
48324845
};
48334846

48344847
MarkersParentModel.prototype.createAllNew = function(scope) {
4835-
var maybeCanceled, typeEvents, typeOptions;
4848+
var isSpiderfied, maybeCanceled, typeEvents, typeOptions;
48364849
if (this.gManager != null) {
4850+
if (this.gManager instanceof SpiderfierMarkerManager) {
4851+
isSpiderfied = this.gManager.isSpiderfied();
4852+
}
48374853
this.gManager.clear();
48384854
delete this.gManager;
48394855
}
@@ -4849,6 +4865,9 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
48494865
this.bindToTypeEvents(typeEvents, ['spiderfy', 'unspiderfy']);
48504866
}
48514867
this.gManager = new SpiderfierMarkerManager(this.map, void 0, typeOptions, typeEvents, this.scope);
4868+
if (isSpiderfied) {
4869+
this.gManager.spiderfy();
4870+
}
48524871
} else {
48534872
this.gManager = new MarkerManager(this.map);
48544873
}

dist/angular-google-maps.min.js

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

dist/angular-google-maps_dev_mapped.js

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! angular-google-maps 2.1.5 2015-08-17
1+
/*! angular-google-maps 2.1.5 2015-08-23
22
* AngularJS directives for Google Maps
33
* git: https://github.com/angular-ui/angular-google-maps.git
44
*/
@@ -2147,6 +2147,7 @@ Nicholas McCready - https://twitter.com/nmccready
21472147
this.opt_events = opt_events;
21482148
this.scope = scope;
21492149
this.checkSync = bind(this.checkSync, this);
2150+
this.isSpiderfied = bind(this.isSpiderfied, this);
21502151
this.getGMarkers = bind(this.getGMarkers, this);
21512152
this.fit = bind(this.fit, this);
21522153
this.destroy = bind(this.destroy, this);
@@ -2159,7 +2160,7 @@ Nicholas McCready - https://twitter.com/nmccready
21592160
this.update = bind(this.update, this);
21602161
this.add = bind(this.add, this);
21612162
this.type = SpiderfierMarkerManager.type;
2162-
this.clusterer = new MarkerSpiderfier(gMap, this.opt_options);
2163+
this.markerSpiderfier = new MarkerSpiderfier(gMap, this.opt_options);
21632164
this.propMapGMarkers = new PropMap();
21642165
this.attachEvents(this.opt_events, 'opt_events');
21652166
this.noDrawOnSingleAddRemoves = true;
@@ -2175,9 +2176,9 @@ Nicholas McCready - https://twitter.com/nmccready
21752176
};
21762177

21772178
SpiderfierMarkerManager.prototype.add = function(gMarker) {
2178-
gMarker.setMap(this.clusterer.map);
2179+
gMarker.setMap(this.markerSpiderfier.map);
21792180
this.checkKey(gMarker);
2180-
this.clusterer.addMarker(gMarker, this.noDrawOnSingleAddRemoves);
2181+
this.markerSpiderfier.addMarker(gMarker, this.noDrawOnSingleAddRemoves);
21812182
this.propMapGMarkers.put(gMarker.key, gMarker);
21822183
return this.checkSync();
21832184
};
@@ -2201,7 +2202,7 @@ Nicholas McCready - https://twitter.com/nmccready
22012202
exists = this.propMapGMarkers.get(gMarker.key);
22022203
if (exists) {
22032204
gMarker.setMap(null);
2204-
this.clusterer.removeMarker(gMarker, this.noDrawOnSingleAddRemoves);
2205+
this.markerSpiderfier.removeMarker(gMarker, this.noDrawOnSingleAddRemoves);
22052206
this.propMapGMarkers.remove(gMarker.key);
22062207
}
22072208
return this.checkSync();
@@ -2226,8 +2227,8 @@ Nicholas McCready - https://twitter.com/nmccready
22262227
return _.each(options, (function(_this) {
22272228
return function(eventHandler, eventName) {
22282229
if (options.hasOwnProperty(eventName) && angular.isFunction(options[eventName])) {
2229-
$log.info(optionsName + ": Attaching event: " + eventName + " to clusterer");
2230-
return _this.clusterer.addListener(eventName, function() {
2230+
$log.info(optionsName + ": Attaching event: " + eventName + " to markerSpiderfier");
2231+
return _this.markerSpiderfier.addListener(eventName, function() {
22312232
if (eventName === 'spiderfy' || eventName === 'unspiderfy') {
22322233
return _this.scope.$evalAsync(options[eventName].apply(options, arguments));
22332234
} else {
@@ -2247,8 +2248,8 @@ Nicholas McCready - https://twitter.com/nmccready
22472248
for (eventName in options) {
22482249
eventHandler = options[eventName];
22492250
if (options.hasOwnProperty(eventName) && angular.isFunction(options[eventName])) {
2250-
$log.info(optionsName + ": Clearing event: " + eventName + " to clusterer");
2251-
results.push(this.clusterer.clearListeners(eventName));
2251+
$log.info(optionsName + ": Clearing event: " + eventName + " to markerSpiderfier");
2252+
results.push(this.markerSpiderfier.clearListeners(eventName));
22522253
} else {
22532254
results.push(void 0);
22542255
}
@@ -2263,11 +2264,17 @@ Nicholas McCready - https://twitter.com/nmccready
22632264
};
22642265

22652266
SpiderfierMarkerManager.prototype.fit = function() {
2266-
return FitHelper.fit(this.getGMarkers(), this.clusterer.map);
2267+
return FitHelper.fit(this.getGMarkers(), this.markerSpiderfier.map);
22672268
};
22682269

22692270
SpiderfierMarkerManager.prototype.getGMarkers = function() {
2270-
return this.clusterer.getMarkers();
2271+
return this.markerSpiderfier.getMarkers();
2272+
};
2273+
2274+
SpiderfierMarkerManager.prototype.isSpiderfied = function() {
2275+
return _.find(this.getGMarkers(), function(gMarker) {
2276+
return (gMarker != null ? gMarker._omsData : void 0) != null;
2277+
});
22712278
};
22722279

22732280
SpiderfierMarkerManager.prototype.checkSync = function() {};
@@ -3278,11 +3285,14 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
32783285
};
32793286

32803287
MarkerChildModel.prototype.renderGMarker = function(doDraw, validCb) {
3281-
var coords;
3288+
var coords, isSpiderfied, ref;
32823289
if (doDraw == null) {
32833290
doDraw = true;
32843291
}
32853292
coords = this.getProp('coords', this.scope, this.model);
3293+
if (((ref = this.gManager) != null ? ref.isSpiderfied : void 0) != null) {
3294+
isSpiderfied = this.gManager.isSpiderfied();
3295+
}
32863296
if (coords != null) {
32873297
if (!this.validateCoords(coords)) {
32883298
$log.debug('MarkerChild does not have coords yet. They may be defined later.');
@@ -3292,7 +3302,10 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
32923302
validCb();
32933303
}
32943304
if (doDraw && this.gObject) {
3295-
return this.gManager.add(this.gObject);
3305+
this.gManager.add(this.gObject);
3306+
}
3307+
if (isSpiderfied) {
3308+
return this.gManager.markerSpiderfier.spiderListener(this.gObject, window.event);
32963309
}
32973310
} else {
32983311
if (doDraw && this.gObject) {
@@ -4832,8 +4845,11 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
48324845
};
48334846

48344847
MarkersParentModel.prototype.createAllNew = function(scope) {
4835-
var maybeCanceled, typeEvents, typeOptions;
4848+
var isSpiderfied, maybeCanceled, typeEvents, typeOptions;
48364849
if (this.gManager != null) {
4850+
if (this.gManager instanceof SpiderfierMarkerManager) {
4851+
isSpiderfied = this.gManager.isSpiderfied();
4852+
}
48374853
this.gManager.clear();
48384854
delete this.gManager;
48394855
}
@@ -4849,6 +4865,9 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
48494865
this.bindToTypeEvents(typeEvents, ['spiderfy', 'unspiderfy']);
48504866
}
48514867
this.gManager = new SpiderfierMarkerManager(this.map, void 0, typeOptions, typeEvents, this.scope);
4868+
if (isSpiderfied) {
4869+
this.gManager.spiderfy();
4870+
}
48524871
} else {
48534872
this.gManager = new MarkerManager(this.map);
48544873
}

dist/angular-google-maps_dev_mapped.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-google-maps_dev_mapped.min.js

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

0 commit comments

Comments
 (0)