mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Scrollbar wouldn't reach the bottom if you scrolled too fast
This commit is contained in:
parent
e489af0b50
commit
3d49a83d7a
4 changed files with 9 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -171,7 +171,6 @@ createWidget('timeline-scrollarea', {
|
|||
|
||||
topicCurrentPostScrolled(event) {
|
||||
const { postIndex, percent } = event;
|
||||
|
||||
this.state.percentage = this._percentFor(this.attrs.topic, parseFloat(postIndex) + percent);
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue