From 45270b55d22c6363a45ebc66fc2026aebf8ad364 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sat, 1 Dec 2012 08:19:24 -0800 Subject: [PATCH] d3 naming convention --- js/id/id.js | 2 +- js/id/renderer/map.js | 4 ++-- js/id/renderer/tiles.js | 7 +++---- test/spec/Map.js | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/js/id/id.js b/js/id/id.js index 7f05425da..571e3a8da 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.size()); + map.size(m.size()); }; d3.select(document).on('keydown', function() { diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index b9dcd9eb0..cdf3d4971 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -256,7 +256,7 @@ iD.Map = function(elem, connection) { .selectAll('#clip-rect') .size(dimensions); - tileclient.setSize(dimensions); + tileclient.size(dimensions); return map; } @@ -523,7 +523,7 @@ iD.Map = function(elem, connection) { map.zoomOut = zoomOut; map.projection = projection; - map.setSize = setSize; + map.size = setSize; map.surface = surface; diff --git a/js/id/renderer/tiles.js b/js/id/renderer/tiles.js index d9bbadfa9..3c02d6f4d 100644 --- a/js/id/renderer/tiles.js +++ b/js/id/renderer/tiles.js @@ -48,11 +48,11 @@ iD.Tiles = function(selection, projection) { .attr("y", function(d) { return d[1]; }); } - function setSize(x) { - tile.size(x); + t.size = function(size) { + tile.size(size); redraw(); return t; - } + }; t.template = function(x) { if (!arguments.length) return template; @@ -61,7 +61,6 @@ iD.Tiles = function(selection, projection) { return t; }; - t.setSize = setSize; t.redraw = redraw; return t; diff --git a/test/spec/Map.js b/test/spec/Map.js index df291f59c..0b91b43d2 100644 --- a/test/spec/Map.js +++ b/test/spec/Map.js @@ -30,7 +30,7 @@ describe('Map', function() { describe('#getExtent', function() { it('reports extent', function() { - expect(map.setSize([100, 100])).toEqual(map); + expect(map.size([100, 100])).toEqual(map); expect(map.center([0, 0])).toEqual(map); expect(map.getExtent()[0][0]).toBeCloseTo(-36); expect(map.getExtent()[1][0]).toBeCloseTo(36);