1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 09:26:34 +02:00

Separate updateScrubber into separate method from onscroll

This commit is contained in:
Alexander Skvortsov
2020-07-06 18:41:58 -04:00
committed by Franz Liedke
parent 5cdfeaf9a5
commit 1360723c3f

View File

@@ -136,7 +136,7 @@ export default class PostStream extends Component {
* *
* @param {Integer} top * @param {Integer} top
*/ */
onscroll(top) { onscroll(top = window.pageYOffset) {
if (this.state.paused) return; if (this.state.paused) return;
const marginTop = this.getMarginTop(); const marginTop = this.getMarginTop();
const viewportHeight = $(window).height() - marginTop; const viewportHeight = $(window).height() - marginTop;
@@ -164,6 +164,14 @@ export default class PostStream extends Component {
clearTimeout(this.calculatePositionTimeout); clearTimeout(this.calculatePositionTimeout);
this.calculatePositionTimeout = setTimeout(this.calculatePosition.bind(this), 100); this.calculatePositionTimeout = setTimeout(this.calculatePosition.bind(this), 100);
this.updateScrubber(top);
}
updateScrubber(top = window.pageYOffset) {
const marginTop = this.getMarginTop();
const viewportHeight = $(window).height() - marginTop;
const viewportTop = top + marginTop;
// Before looping through all of the posts, we reset the scrollbar // Before looping through all of the posts, we reset the scrollbar
// properties to a 'default' state. These values reflect what would be // properties to a 'default' state. These values reflect what would be
// seen if the browser were scrolled right up to the top of the page, // seen if the browser were scrolled right up to the top of the page,