From 98da353c45557ae7697978621fca4ebd4d6a9463 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Thu, 15 Nov 2012 16:24:39 -0500 Subject: [PATCH] Round coordinates. Appears to improve performance, see #87 and http://bl.ocks.org/4081356 --- js/iD/renderer/Map.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/iD/renderer/Map.js b/js/iD/renderer/Map.js index be9e9c23d..69f7af4d3 100755 --- a/js/iD/renderer/Map.js +++ b/js/iD/renderer/Map.js @@ -18,6 +18,13 @@ iD.Map = function(elem) { return { lon: o[0], lat: o[1] }; } + function roundCoords(c) { + return [ + Math.floor(c[0]), + Math.floor(c[1]) + ]; + } + var map = {}, width, height, dispatch = d3.dispatch('move', 'update'), @@ -48,7 +55,7 @@ iD.Map = function(elem) { }) .on('dragend', map.update), nodeline = function(d) { - return 'M' + d.nodes.map(ll2a).map(projection).join('L'); + return 'M' + d.nodes.map(ll2a).map(projection).map(roundCoords).join('L'); }, key = function(d) { return d.id; };