try to improve scrolling experience

This commit is contained in:
Tor Hveem 2013-12-09 11:10:11 +01:00 committed by Lorenz H-S
parent 3b2af82d36
commit 797be76c95

View file

@ -580,16 +580,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.scrollToBottom = function() { $rootScope.scrollToBottom = function() {
// FIXME doesn't work if the settimeout runs without a short delay // FIXME doesn't work if the settimeout runs without a short delay
var scroll = function() { var scroll = function() {
var readmarker = document.getElementById('readmarker'); var bl = document.getElementById('bufferlines');
if(readmarker) { var sTop = bl.scrollTop;
readmarker.scrollIntoView(); var sVal = bl.scrollHeight - bl.clientHeight;
}else{ if(sTop < sVal) {
var bl = document.getElementById('bufferlines'); bl.scrollTop = sVal;
var sTop = bl.scrollTop;
var sVal = bl.scrollHeight - bl.clientHeight;
if(sTop < sVal) {
bl.scrollTop = sVal;
}
} }
}; };
// Here be scrolling dragons // Here be scrolling dragons