From a393248b371fbfa649ddb75b9151cfac57ac62fb Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 6 Jan 2016 00:12:15 -0500 Subject: [PATCH] Add iD.Map#redrawEnable to enable/disable redraws --- js/id/id.js | 1 + js/id/renderer/map.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/id/id.js b/js/id/id.js index 318f746e9..fa28cc0dc 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -267,6 +267,7 @@ window.iD = function () { context.zoomOut = map.zoomOut; context.zoomInFurther = map.zoomInFurther; context.zoomOutFurther = map.zoomOutFurther; + context.redrawEnable = map.redrawEnable; context.surfaceRect = function() { // Work around a bug in Firefox. diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 349f6257d..94023f33e 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -8,6 +8,7 @@ iD.Map = function(context) { .scaleExtent([1024, 256 * Math.pow(2, 24)]) .on('zoom', zoomPan), dblclickEnabled = true, + redrawEnabled = true, transformStart, transformed = false, minzoom = 0, @@ -186,7 +187,7 @@ iD.Map = function(context) { } function redraw(difference, extent) { - if (!surface) return; + if (!surface || !redrawEnabled) return; clearTimeout(timeoutId); @@ -255,6 +256,12 @@ iD.Map = function(context) { return map; }; + map.redrawEnable = function(_) { + if (!arguments.length) return redrawEnabled; + redrawEnabled = _; + return map; + }; + function interpolateZoom(_) { var k = projection.scale(), t = projection.translate();