don't throttle update on hash change, fixes #2023

This commit is contained in:
Vladimir Agafonkin
2013-11-26 20:15:14 +02:00
parent bf8801cf16
commit 06438489fb
+5 -3
View File
@@ -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
}
}