animated scrolling could leave cursor off screen

This commit is contained in:
nightwing 2012-05-12 11:22:01 +04:00
commit 1def900834

View file

@ -1068,7 +1068,7 @@ var VirtualRenderer = function(container, theme) {
var _self = this;
var steps = _self.$calcSteps(fromValue, toValue);
this.$inScrollAnimation = true;
clearInterval(this.$timer);
_self.session.setScrollTop(steps.shift());
@ -1077,18 +1077,20 @@ var VirtualRenderer = function(container, theme) {
_self.session.setScrollTop(steps.shift());
// trick session to think it's already scrolled to not loose toValue
_self.session.$scrollTop = toValue;
} else {
_self.$inScrollAnimation = false;
clearInterval(_self.$timer);
} else if (toValue != null) {
_self.session.$scrollTop = -1;
_self.session.setScrollTop(toValue);
toValue = null;
} else {
// do this on separate step to not get spurious scroll event from scrollbar
_self.$timer = clearInterval(_self.$timer);
_self.$inScrollAnimation = false;
callback && callback();
}
}, 10);
}
};
/**
* VirtualRenderer.scrollToY(scrollTop) -> Number
* - scrollTop (Number): The position to scroll to