mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-16 18:06:55 +00:00
4.9.5
* Added: Picture-in-Picture button for the player, when supported by your browser. * Added: Option to disable the `Reset Player` button for the player. * Fixed: Smooth scrolling not functioning once the chat buffer fills. It's still a bit peculiar, but at least it's somewhat working now. Please disable the feature for now if the behavior is bothering you or causing issues. * Fixed: The Featured channels menu not loading, for channels using that FFZ feature. * Fixed: Certain add-on emotes appearing in the emote tab-completion menu multiple times. * Fixed: Cheers not rendering correctly in chat.
This commit is contained in:
parent
9894e9a7cb
commit
512fe8898d
5 changed files with 166 additions and 12 deletions
|
@ -29,7 +29,7 @@ export default class Scroller extends Module {
|
|||
|
||||
this.ChatScroller = this.fine.define(
|
||||
'chat-scroller',
|
||||
n => n.saveScrollRef && n.handleScrollEvent && ! n.renderLines,
|
||||
n => n.saveScrollRef && n.handleScrollEvent && ! n.renderLines && n.resume,
|
||||
Twilight.CHAT_ROUTES
|
||||
);
|
||||
|
||||
|
@ -162,8 +162,23 @@ export default class Scroller extends Module {
|
|||
|
||||
this.ChatScroller.ready((cls, instances) => {
|
||||
const old_catch = cls.prototype.componentDidCatch,
|
||||
old_snapshot = cls.prototype.getSnapshotBeforeUpdate,
|
||||
old_render = cls.prototype.render;
|
||||
|
||||
if ( old_snapshot )
|
||||
cls.prototype.getSnapshotBeforeUpdate = function() {
|
||||
let auto_state;
|
||||
if ( this.state ) {
|
||||
auto_state = this.state.isAutoScrolling;
|
||||
this.state.isAutoScrolling = false;
|
||||
}
|
||||
const out = old_snapshot.call(this);
|
||||
if ( this.state )
|
||||
this.state.isAutoScrolling = auto_state;
|
||||
this._ffz_snapshot = out;
|
||||
return out;
|
||||
}
|
||||
|
||||
// Try catching errors. With any luck, maybe we can
|
||||
// recover from the error when we re-build?
|
||||
cls.prototype.componentDidCatch = function(err, info) {
|
||||
|
@ -240,13 +255,23 @@ export default class Scroller extends Module {
|
|||
inst.smoothScrollBottom();
|
||||
else {
|
||||
inst._ffz_one_fast_scroll = false;
|
||||
inst._ffz_snapshot = null;
|
||||
inst.ffz_oldScroll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inst.scrollToBottom = function() {
|
||||
if ( inst._ffz_scroll_frame || inst.state.isPaused )
|
||||
// WIP: Trying to fix the scroll position changing so that we can
|
||||
// smooth scroll from the previous position.
|
||||
if ( inst.ffz_smooth_scroll && ! inst._ffz_one_fast_scroll && inst._ffz_snapshot ) {
|
||||
const adjustment = inst._ffz_snapshot && inst._ffz_snapshot.lastLine ? inst._ffz_snapshot.offsetTop - inst._ffz_snapshot.lastLine.offsetTop : 0;
|
||||
if ( inst.scroll && inst.scroll.scrollContent && adjustment > 0 )
|
||||
inst.scroll.scrollContent.scrollTop -= adjustment;
|
||||
}
|
||||
|
||||
inst._ffz_snapshot = null;
|
||||
if ( inst.state.isPaused || inst._ffz_scroll_frame )
|
||||
return;
|
||||
|
||||
this._ffz_scroll_frame = requestAnimationFrame(inst.ffz_doScroll);
|
||||
|
@ -592,7 +617,7 @@ export default class Scroller extends Module {
|
|||
} else if ( difference > 200 ) {
|
||||
// we are starting to fall behind, speed it up a bit
|
||||
step += step * Math.floor(difference / 200);
|
||||
}
|
||||
}
|
||||
|
||||
const smoothAnimation = () => {
|
||||
if ( this.state.isPaused || ! this.state.isAutoScrolling )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue