From 3c99d36a768a2e17a4b9bea0aefd39592d57b197 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 28 Jan 2013 16:54:38 -0500 Subject: [PATCH] Fix differenced redraw artifacts during pan/zoom Fixes #543. --- js/id/renderer/map.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index bc4ca8e03..60ad3de39 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -165,24 +165,33 @@ iD.Map = function() { } function resetTransform() { - if (!surface.style(transformProp)) return; + if (!surface.style(transformProp)) return false; surface.style(transformProp, ''); tilegroup.style(transformProp, ''); + return true; } function redraw(difference) { - resetTransform(); + // If we are in the middle of a zoom/pan, we can't do differenced redraws. + // It would result in artifacts where differenced entities are redrawn with + // one transform and unchanged entities with another. + if (resetTransform()) + difference = undefined; + surface.attr('data-zoom', ~~map.zoom()); tilegroup.call(background); + if (map.editable()) { connection.loadTiles(projection, dimensions); drawVector(difference); } else { editOff(); } + transformStart = [ projection.scale(), projection.translate().slice()]; + return map; }