FIX: Scrollbar wouldn't reach the bottom if you scrolled too fast
This commit is contained in:
parent
e489af0b50
commit
3d49a83d7a
|
@ -92,6 +92,8 @@ export default MountWidget.extend({
|
||||||
// uncomment to debug the eyeline
|
// uncomment to debug the eyeline
|
||||||
// $('.debug-eyeline').css({ height: '1px', width: '100%', backgroundColor: 'blue', position: 'absolute', top: `${topCheck}px` });
|
// $('.debug-eyeline').css({ height: '1px', width: '100%', backgroundColor: 'blue', position: 'absolute', top: `${topCheck}px` });
|
||||||
|
|
||||||
|
let allAbove = true;
|
||||||
|
|
||||||
let bottomView = topView;
|
let bottomView = topView;
|
||||||
while (bottomView < $posts.length) {
|
while (bottomView < $posts.length) {
|
||||||
const post = $posts[bottomView];
|
const post = $posts[bottomView];
|
||||||
|
@ -103,6 +105,8 @@ export default MountWidget.extend({
|
||||||
const postHeight = $post.height();
|
const postHeight = $post.height();
|
||||||
const viewBottom = Math.ceil(viewTop + postHeight);
|
const viewBottom = Math.ceil(viewTop + postHeight);
|
||||||
|
|
||||||
|
allAbove = allAbove && (viewTop < topCheck);
|
||||||
|
|
||||||
if (viewTop > viewportBottom) { break; }
|
if (viewTop > viewportBottom) { break; }
|
||||||
|
|
||||||
if (viewBottom >= windowTop && viewTop <= windowBottom) {
|
if (viewBottom >= windowTop && viewTop <= windowBottom) {
|
||||||
|
@ -115,10 +119,14 @@ export default MountWidget.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
nearby.push(bottomView);
|
nearby.push(bottomView);
|
||||||
|
|
||||||
bottomView++;
|
bottomView++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allAbove) {
|
||||||
|
if (percent === null) { percent = 1.0; }
|
||||||
|
if (currentPost === null) { currentPost = bottomView - 1; }
|
||||||
|
}
|
||||||
|
|
||||||
const posts = this.posts;
|
const posts = this.posts;
|
||||||
const refresh = cb => this.queueRerender(cb);
|
const refresh = cb => this.queueRerender(cb);
|
||||||
if (onscreen.length) {
|
if (onscreen.length) {
|
||||||
|
|
|
@ -68,8 +68,6 @@ const SiteHeaderComponent = MountWidget.extend(Docking, {
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this._super();
|
this._super();
|
||||||
$('body').off('keydown.header');
|
$('body').off('keydown.header');
|
||||||
this.appEvents.off('notifications:changed');
|
|
||||||
this.appEvents.off('header:keyboard-trigger');
|
|
||||||
$(window).off('resize.discourse-menu-panel');
|
$(window).off('resize.discourse-menu-panel');
|
||||||
|
|
||||||
this.appEvents.off('header:show-topic');
|
this.appEvents.off('header:show-topic');
|
||||||
|
|
|
@ -55,10 +55,5 @@ export default MountWidget.extend(Docking, {
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super();
|
this._super();
|
||||||
this.dispatch('topic:current-post-scrolled', 'timeline-scrollarea');
|
this.dispatch('topic:current-post-scrolled', 'timeline-scrollarea');
|
||||||
},
|
|
||||||
|
|
||||||
willDestroyElement() {
|
|
||||||
this._super();
|
|
||||||
this.appEvents.off('topic:current-post-scrolled');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -171,7 +171,6 @@ createWidget('timeline-scrollarea', {
|
||||||
|
|
||||||
topicCurrentPostScrolled(event) {
|
topicCurrentPostScrolled(event) {
|
||||||
const { postIndex, percent } = event;
|
const { postIndex, percent } = event;
|
||||||
|
|
||||||
this.state.percentage = this._percentFor(this.attrs.topic, parseFloat(postIndex) + percent);
|
this.state.percentage = this._percentFor(this.attrs.topic, parseFloat(postIndex) + percent);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue