FIX: Scrollbar wouldn't reach the bottom if you scrolled too fast

This commit is contained in:
Robin Ward 2016-06-01 13:10:33 -04:00
parent e489af0b50
commit 3d49a83d7a
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
4 changed files with 9 additions and 9 deletions

View File

@ -92,6 +92,8 @@ export default MountWidget.extend({
// uncomment to debug the eyeline
// $('.debug-eyeline').css({ height: '1px', width: '100%', backgroundColor: 'blue', position: 'absolute', top: `${topCheck}px` });
let allAbove = true;
let bottomView = topView;
while (bottomView < $posts.length) {
const post = $posts[bottomView];
@ -103,6 +105,8 @@ export default MountWidget.extend({
const postHeight = $post.height();
const viewBottom = Math.ceil(viewTop + postHeight);
allAbove = allAbove && (viewTop < topCheck);
if (viewTop > viewportBottom) { break; }
if (viewBottom >= windowTop && viewTop <= windowBottom) {
@ -115,10 +119,14 @@ export default MountWidget.extend({
}
nearby.push(bottomView);
bottomView++;
}
if (allAbove) {
if (percent === null) { percent = 1.0; }
if (currentPost === null) { currentPost = bottomView - 1; }
}
const posts = this.posts;
const refresh = cb => this.queueRerender(cb);
if (onscreen.length) {

View File

@ -68,8 +68,6 @@ const SiteHeaderComponent = MountWidget.extend(Docking, {
willDestroyElement() {
this._super();
$('body').off('keydown.header');
this.appEvents.off('notifications:changed');
this.appEvents.off('header:keyboard-trigger');
$(window).off('resize.discourse-menu-panel');
this.appEvents.off('header:show-topic');

View File

@ -55,10 +55,5 @@ export default MountWidget.extend(Docking, {
didInsertElement() {
this._super();
this.dispatch('topic:current-post-scrolled', 'timeline-scrollarea');
},
willDestroyElement() {
this._super();
this.appEvents.off('topic:current-post-scrolled');
}
});

View File

@ -171,7 +171,6 @@ createWidget('timeline-scrollarea', {
topicCurrentPostScrolled(event) {
const { postIndex, percent } = event;
this.state.percentage = this._percentFor(this.attrs.topic, parseFloat(postIndex) + percent);
},