commit 29ca2723565614ac3445d0bf0a7870d5cbbca39e
Author: Iain R. Learmonth <irl(a)fsfe.org>
Date: Sat Dec 2 18:27:20 2017 +0000
Smoother transitions for map aggregatation property
---
js/views/aggregate/map.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/js/views/aggregate/map.js b/js/views/aggregate/map.js
index f585e33..4026ebc 100644
--- a/js/views/aggregate/map.js
+++ b/js/views/aggregate/map.js
@@ -18,6 +18,8 @@ define([
this.collection = new aggregatesCollection;
},
plot: function() {
+ $('input[name="aggregate-property"]').prop('disabled', true);
+
var aggregate_property = $('input[name="aggregate-property"]:checked').val();
var aggregates = this.collection.models;
@@ -32,9 +34,8 @@ define([
var path = d3.geo.path()
.projection(projection);
- $("#aggregate-map").html("");
-
- var svg = d3.select("#aggregate-map").append("svg")
+ var svg = d3.select("body").append("svg")
+ .remove()
.attr("preserveAspectRatio", "xMidYMid")
.attr("viewBox", "0 0 " + width + " " + height)
@@ -116,6 +117,10 @@ define([
.text("" + (Math.pow(i,2)* maximum_value*100).toFixed(3) + "%");
}
+ $("#aggregate-map").html("");
+ document.getElementById("aggregate-map").appendChild(svg.node());
+
+ $('input[name="aggregate-property"]').prop('disabled', false);
});
},
save: function() {