From 06438489fb75042d14fe7370478d7b8aa65bba15 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Tue, 26 Nov 2013 20:15:14 +0200 Subject: [PATCH] don't throttle update on hash change, fixes #2023 --- js/id/behavior/hash.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/id/behavior/hash.js b/js/id/behavior/hash.js index 447e8f6c1..54c1ead0e 100644 --- a/js/id/behavior/hash.js +++ b/js/id/behavior/hash.js @@ -25,15 +25,17 @@ iD.behavior.Hash = function(context) { }), true); }; - var move = _.throttle(function() { + function update() { var s1 = formatter(context.map()); if (s0 !== s1) location.replace(s0 = s1); // don't recenter the map! - }, 500, {leading: false}); + } + + var move = _.throttle(update, 500, {leading: false}); function hashchange() { if (location.hash === s0) return; // ignore spurious hashchange events if (parser(context.map(), (s0 = location.hash).substring(1))) { - move(); // replace bogus hash + update(); // replace bogus hash } }