diff --git a/index.html b/index.html
index 44d5fb8b2..bc8950ff6 100644
--- a/index.html
+++ b/index.html
@@ -18,6 +18,7 @@
+
diff --git a/js/id/id.js b/js/id/id.js
index fab9fdd1d..7f05425da 100644
--- a/js/id/id.js
+++ b/js/id/id.js
@@ -130,7 +130,7 @@ var iD = function(container) {
});
window.onresize = function() {
- map.setSize([m.node().offsetWidth, m.node().offsetHeight]);
+ map.setSize(m.size());
};
d3.select(document).on('keydown', function() {
diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js
index e045e5120..b9dcd9eb0 100644
--- a/js/id/renderer/map.js
+++ b/js/id/renderer/map.js
@@ -248,10 +248,14 @@ iD.Map = function(elem, connection) {
.classed('active', classActive);
}
- function setSize(x) {
- dimensions = x;
- var attr = { width: dimensions[0], height: dimensions[1] };
- surface.attr(attr).selectAll('#clip-rect').attr(attr);
+ function setSize(size) {
+ dimensions = size;
+
+ surface
+ .size(dimensions)
+ .selectAll('#clip-rect')
+ .size(dimensions);
+
tileclient.setSize(dimensions);
return map;
}
@@ -532,7 +536,7 @@ iD.Map = function(elem, connection) {
map.flush = flush;
map.dblclickEnable = dblclickEnable;
- setSize([parent.node().offsetWidth, parent.node().offsetHeight]);
+ setSize(parent.size());
hideInspector();
redraw();
diff --git a/js/lib/d3.size.js b/js/lib/d3.size.js
new file mode 100644
index 000000000..01ec8183a
--- /dev/null
+++ b/js/lib/d3.size.js
@@ -0,0 +1,8 @@
+d3.selection.prototype.size = function (size) {
+ if (!arguments.length) {
+ var node = this.node();
+ return [node.offsetWidth,
+ node.offsetHeight];
+ }
+ return this.attr({width: size[0], height: size[1]});
+};
diff --git a/test/index.html b/test/index.html
index a7abe9c64..7d8e4b878 100644
--- a/test/index.html
+++ b/test/index.html
@@ -14,6 +14,7 @@
+