From 2d07f95c55526061d5ffd8b429a652ae973f2edd Mon Sep 17 00:00:00 2001 From: Scimonster Date: Sun, 3 Nov 2013 17:47:32 +0200 Subject: [PATCH] Fixed scrolling. --- js/Reporter.js | 14 ++++++++++---- player.css | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/js/Reporter.js b/js/Reporter.js index e149658..a068d03 100644 --- a/js/Reporter.js +++ b/js/Reporter.js @@ -148,11 +148,15 @@ List.prototype.attach = function(scene) { }); $('body').mousemove(function(e){ if (sb.data('scrolling')) { - var offset = e.pageY-sb.data('startY'); - if (offset > -1 && offset < c.height()-sb.height()) { - sb.css('top',offset); - c.scrollTop(offset); + var offset = parseInt(sb.css('top'))+e.pageY-sb.data('startY'); + if (offset < 0) { + offset = 0; } + if (offset > c.height()-sb.height()) { + offset = c.height()-sb.height(); + } + sb.css('top',offset); + c.scrollTop(c.height()/sb.height()*offset); } }).mouseup(function(){ if ($.hasData(sb[0],'scrolling')) sb.removeData(['scrolling','startY']); @@ -178,6 +182,8 @@ List.prototype.update = function(){ $('
').appendTo(c).append('
'+(i+1),'
'+val); }); c.height(this.height-26); + c.find('.list-index').width(c.find('.list-index').last().width()); + c.find('.list-item').width(c.width()-c.find('.list-index').width()-15) var s = this.scrollbar.height(this.height-26); s.children('.list-scrollbar').height(s.height()/c[0].scrollHeight*s.height()).css('display', s.children('.list-scrollbar').height()===c.height() ? 'none' : 'inline-block'); this.el.find('.list-length').text('length: '+this.contents.length); diff --git a/player.css b/player.css index 61573de..a0ee51d 100644 --- a/player.css +++ b/player.css @@ -132,13 +132,14 @@ float: left; padding: 2px; margin-top: 0px; - font: bold 10px Verdana,sans-serif; + font: bold 10px monospace; } .list .list-item { float: left; width: 70%; - min-height: 18px; + height: 16px; + overflow: hidden; margin-bottom: 0px; margin-right: 2px; padding-left: 5px;