public/map.html in snapa-0.0.3 vs public/map.html in snapa-0.0.4
- old
+ new
@@ -4,10 +4,13 @@
<style>
body {
margin: 0;
}
+svg {
+ display: block;
+}
.subunit {
fill: #D7D7D7;
stroke: #F2F2F2;
stroke-width: 1.5;
}
@@ -28,11 +31,11 @@
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var countries = (getParameterByName('c') || 'TZ').toUpperCase().split(','),
- width = getParameterByName('w') || 380,
+ width = getParameterByName('w') || 400,
height = getParameterByName('h') || 230,
rotation = getParameterByName('r').split(','),
scale = getParameterByName('s'),
percent = getParameterByName('p') || .80,
highlight;
@@ -61,18 +64,19 @@
}
}
if (rotation[0] === '') {
var centroid = d3.geo.centroid(highlight);
- rotation = [-centroid[0], -centroid[1]]
+ rotation = [-centroid[0], -centroid[1], 0];
}
projection
.rotate(rotation);
if (scale === '') {
var bounds = path.bounds(highlight);
scale = percent / Math.max((bounds[1][0] - bounds[0][0]) / width, (bounds[1][1] - bounds[0][1]) / height);
+ scale = Math.min(scale, 1000);
}
projection
.scale(scale);