Merge pull request #2027 from mourner/master

Don't throttle update on hash change, fixes #2023
This commit is contained in:
John Firebaugh
2013-11-26 10:29:25 -08:00
+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
}
}