write a test for automatic clustering and fix render issue

This commit is contained in:
Dominik Moritz
2012-09-12 14:02:54 +01:00
parent 89890c8acb
commit 3ecd0b875b
2 changed files with 29 additions and 5 deletions

View File

@@ -92,6 +92,9 @@ my.Map = Backbone.View.extend({
self.state.set(self.menu.state.toJSON());
self.redraw();
});
this.state.bind('change', function() {
self.redraw();
});
this.elSidebar = this.menu.el;
},
@@ -179,7 +182,7 @@ my.Map = Backbone.View.extend({
var countAfter = 0;
this.features.eachLayer(function(){countAfter++;});
var sizeIncreased = countAfter - countBefore > 0;
if (!this.state.get('cluster') && countAfter > 100 && sizeIncreased) {
if (!this.state.get('cluster') && countAfter > 99 && sizeIncreased) {
this.state.set({cluster: true});
return;
}