don't update hash/attrib immediately on move start

Makes panning snappier by avoiding non-critical operations at the very
start.
This commit is contained in:
Vladimir Agafonkin
2013-11-22 00:27:40 +02:00
parent c133ed28d2
commit dab1fa8eaf
2 changed files with 2 additions and 2 deletions

View File

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

View File

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