diff --git a/Makefile b/Makefile
index e32d5d78d..529132034 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ dist/iD.js: \
js/lib/d3.jsonp.js \
js/lib/d3.keybinding.js \
js/lib/d3.one.js \
- js/lib/d3.size.js \
+ js/lib/d3.dimensions.js \
js/lib/d3.trigger.js \
js/lib/d3.typeahead.js \
js/lib/d3.curtain.js \
diff --git a/index.html b/index.html
index 2438b2826..cb4d20ebc 100644
--- a/index.html
+++ b/index.html
@@ -20,7 +20,7 @@
-
+
diff --git a/js/id/behavior/tail.js b/js/id/behavior/tail.js
index 26f5b1ec2..e596a76dd 100644
--- a/js/id/behavior/tail.js
+++ b/js/id/behavior/tail.js
@@ -10,11 +10,11 @@ iD.behavior.Tail = function() {
if (!text) return;
d3.select(window)
- .on('resize.tail', function() { selection_size = selection.size(); });
+ .on('resize.tail', function() { selection_size = selection.dimensions(); });
function show() {
container.style('display', 'block');
- tooltip_size = container.size();
+ tooltip_size = container.dimensions();
}
function mousemove() {
@@ -55,8 +55,8 @@ iD.behavior.Tail = function() {
container
.on('mousemove.tail', mousemove);
- tooltip_size = container.size();
- selection_size = selection.size();
+ tooltip_size = container.dimensions();
+ selection_size = selection.dimensions();
}
tail.off = function(selection) {
diff --git a/js/id/modes/drag_node.js b/js/id/modes/drag_node.js
index 6afb36144..ea3a6ef4b 100644
--- a/js/id/modes/drag_node.js
+++ b/js/id/modes/drag_node.js
@@ -93,7 +93,7 @@ iD.modes.DragNode = function(context) {
var nudge = childOf(context.container().node(),
d3.event.sourceEvent.toElement) &&
- edge(d3.event.point, context.map().size());
+ edge(d3.event.point, context.map().dimensions());
if (nudge) startNudge(nudge);
else stopNudge();
diff --git a/js/id/modes/move.js b/js/id/modes/move.js
index bba666ece..0aa40c26b 100644
--- a/js/id/modes/move.js
+++ b/js/id/modes/move.js
@@ -54,7 +54,7 @@ iD.modes.Move = function(context, entityIDs) {
p[1] - context.projection(origin)[1]] :
[0, 0];
- var nudge = edge(p, context.map().size());
+ var nudge = edge(p, context.map().dimensions());
if (nudge) startNudge(nudge);
else stopNudge();
diff --git a/js/id/renderer/background.js b/js/id/renderer/background.js
index ce1d00c7e..4ad0283a9 100644
--- a/js/id/renderer/background.js
+++ b/js/id/renderer/background.js
@@ -167,7 +167,7 @@ iD.Background = function(backgroundType) {
return background;
};
- background.size = function(_) {
+ background.dimensions = function(_) {
if (!arguments.length) return tile.size();
tile.size(_);
return background;
diff --git a/js/id/renderer/localgpx.js b/js/id/renderer/localgpx.js
index 9c43fba72..438b06609 100644
--- a/js/id/renderer/localgpx.js
+++ b/js/id/renderer/localgpx.js
@@ -2,7 +2,6 @@ iD.LocalGpx = function(context) {
var projection,
gj = {},
enable = true,
- size = [0, 0],
svg;
function render(selection) {
@@ -50,9 +49,9 @@ iD.LocalGpx = function(context) {
return render;
};
- render.size = function(_) {
- if (!arguments.length) return svg.size();
- svg.size(_);
+ render.dimensions = function(_) {
+ if (!arguments.length) return svg.dimensions();
+ svg.dimensions(_);
return render;
};
diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js
index cd06aa42a..e854d710d 100644
--- a/js/id/renderer/map.js
+++ b/js/id/renderer/map.js
@@ -87,7 +87,7 @@ iD.Map = function(context) {
}
});
- map.size(selection.size());
+ map.dimensions(selection.dimensions());
labels.supersurface(supersurface);
mouse = iD.util.fastMouse(supersurface.node());
@@ -315,13 +315,13 @@ iD.Map = function(context) {
return redraw();
};
- map.size = function(_) {
+ map.dimensions = function(_) {
if (!arguments.length) return dimensions;
var center = map.center();
dimensions = _;
- surface.size(dimensions);
+ surface.dimensions(dimensions);
layers.forEach(function(layer) {
- layer.size(dimensions);
+ layer.dimensions(dimensions);
});
projection.clipExtent([[0, 0], dimensions]);
setCenter(center);
diff --git a/js/id/ui.js b/js/id/ui.js
index acb64c830..e91ace906 100644
--- a/js/id/ui.js
+++ b/js/id/ui.js
@@ -131,7 +131,7 @@ iD.ui = function(context) {
};
d3.select(window).on('resize.editor', function() {
- map.size(m.size());
+ map.dimensions(m.dimensions());
});
function pan(d) {
diff --git a/js/id/ui/intro/navigation.js b/js/id/ui/intro/navigation.js
index 3411b1f59..032faa4ea 100644
--- a/js/id/ui/intro/navigation.js
+++ b/js/id/ui/intro/navigation.js
@@ -26,8 +26,8 @@ iD.ui.intro.navigation = function(context, reveal) {
var map = {
left: 30,
top: 60,
- width: context.map().size()[0] - 60,
- height: context.map().size()[1] - 200
+ width: context.map().dimensions()[0] - 60,
+ height: context.map().dimensions()[1] - 200
};
context.map().centerZoom([-85.63591, 41.94285], 19);
diff --git a/js/lib/d3.curtain.js b/js/lib/d3.curtain.js
index 2c8a16e70..61e7aee67 100644
--- a/js/lib/d3.curtain.js
+++ b/js/lib/d3.curtain.js
@@ -57,10 +57,10 @@ d3.curtain = function() {
var html = parts[0] ? '' + parts[0] + '' : '';
if (parts[1]) html += '' + parts[1] + '';
- var size = tooltip.classed('in', true)
+ var dimensions = tooltip.classed('in', true)
.select('.tooltip-inner')
.html(html)
- .size();
+ .dimensions();
var pos;
@@ -69,23 +69,23 @@ d3.curtain = function() {
if (box.top + box.height < Math.min(100, box.width + box.left)) {
side = 'bottom';
- pos = [box.left + box.width / 2 - size[0]/ 2, box.top + box.height];
+ pos = [box.left + box.width / 2 - dimensions[0]/ 2, box.top + box.height];
} else if (box.left + box.width + 300 < window.innerWidth) {
side = 'right';
- pos = [box.left + box.width, box.top + box.height / 2 - size[1] / 2];
+ pos = [box.left + box.width, box.top + box.height / 2 - dimensions[1] / 2];
} else if (box.left > 300) {
side = 'left';
- pos = [box.left - 200, box.top + box.height / 2 - size[1] / 2];
+ pos = [box.left - 200, box.top + box.height / 2 - dimensions[1] / 2];
} else {
side = 'bottom';
pos = [box.left, box.top + box.height];
}
pos = [
- Math.min(Math.max(10, pos[0]), w - size[0] - 10),
- Math.min(Math.max(10, pos[1]), h - size[1] - 10)
+ Math.min(Math.max(10, pos[0]), w - dimensions[0] - 10),
+ Math.min(Math.max(10, pos[1]), h - dimensions[1] - 10)
];
diff --git a/js/lib/d3.size.js b/js/lib/d3.dimensions.js
similarity index 52%
rename from js/lib/d3.size.js
rename to js/lib/d3.dimensions.js
index 01ec8183a..7f9ef0521 100644
--- a/js/lib/d3.size.js
+++ b/js/lib/d3.dimensions.js
@@ -1,8 +1,8 @@
-d3.selection.prototype.size = function (size) {
+d3.selection.prototype.dimensions = function (dimensions) {
if (!arguments.length) {
var node = this.node();
return [node.offsetWidth,
node.offsetHeight];
}
- return this.attr({width: size[0], height: size[1]});
+ return this.attr({width: dimensions[0], height: dimensions[1]});
};
diff --git a/test/index.html b/test/index.html
index 5fa791a9e..65c751d10 100644
--- a/test/index.html
+++ b/test/index.html
@@ -23,7 +23,7 @@
-
+
diff --git a/test/spec/renderer/background.js b/test/spec/renderer/background.js
index f34cbf61a..0a47f9a88 100644
--- a/test/spec/renderer/background.js
+++ b/test/spec/renderer/background.js
@@ -16,9 +16,9 @@ describe('iD.Background', function() {
expect(c).to.be.ok;
});
- it('#size', function() {
- expect(c.size([100, 100])).to.equal(c);
- expect(c.size()).to.eql([100,100]);
+ it('#dimensions', function() {
+ expect(c.dimensions([100, 100])).to.equal(c);
+ expect(c.dimensions()).to.eql([100,100]);
});
});
});
diff --git a/test/spec/renderer/map.js b/test/spec/renderer/map.js
index 4f2d965d7..f00ce1f28 100644
--- a/test/spec/renderer/map.js
+++ b/test/spec/renderer/map.js
@@ -101,7 +101,7 @@ describe('iD.Map', function() {
describe('#extent', function() {
it('gets and sets extent', function() {
- map.size([100, 100])
+ map.dimensions([100, 100])
.center([0, 0]);
expect(map.extent()[0][0]).to.be.closeTo(-17.5, 0.5);