From dab1fa8eaf54a5d0094a8e6972a35a98b7ff50b3 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 22 Nov 2013 00:27:40 +0200 Subject: [PATCH] don't update hash/attrib immediately on move start Makes panning snappier by avoiding non-critical operations at the very start. --- js/id/behavior/hash.js | 2 +- js/id/ui/attribution.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/id/behavior/hash.js b/js/id/behavior/hash.js index 9c7f7175a..447e8f6c1 100644 --- a/js/id/behavior/hash.js +++ b/js/id/behavior/hash.js @@ -28,7 +28,7 @@ iD.behavior.Hash = function(context) { var move = _.throttle(function() { var s1 = formatter(context.map()); if (s0 !== s1) location.replace(s0 = s1); // don't recenter the map! - }, 500); + }, 500, {leading: false}); function hashchange() { if (location.hash === s0) return; // ignore spurious hashchange events diff --git a/js/id/ui/attribution.js b/js/id/ui/attribution.js index 2fef3c390..889e45d2f 100644 --- a/js/id/ui/attribution.js +++ b/js/id/ui/attribution.js @@ -73,7 +73,7 @@ iD.ui.Attribution = function(context) { .on('change.attribution', update); context.map() - .on('move.attribution', _.throttle(update, 400)); + .on('move.attribution', _.throttle(update, 400, {leading: false})); update(); };