Add iD.Map#redrawEnable to enable/disable redraws

This commit is contained in:
Bryan Housel
2016-01-06 00:12:15 -05:00
parent f2a8f7181b
commit a393248b37
2 changed files with 9 additions and 1 deletions

View File

@@ -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.

View File

@@ -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();