1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-09 15:50:53 +00:00
* Fixed: The player not resizing appropriately when certain layout overrides are applied to the Twitch page. (Closes #925)
This commit is contained in:
SirStendec 2020-10-16 15:19:11 -04:00
parent b88e6f0f75
commit 8ea12ab73c
5 changed files with 45 additions and 8 deletions

View file

@ -30,6 +30,11 @@ export default class Layout extends Module {
n => n.hideOnBreakpoint && n.handleToggleVisibility
);*/
this.ResizeDetector = this.fine.define(
'resize-detector',
n => n.maybeDebounceOnScroll && n.setGrowDivRef && n.props.onResize
);
this.SideBarChannels = this.fine.define(
'nav-cards',
t => t.getCardSlideInContent && t.props && has(t.props, 'tooltipContent')
@ -184,6 +189,7 @@ export default class Layout extends Module {
document.body.classList.toggle('ffz--portrait-invert', this.settings.get('layout.portrait-invert'));
this.on(':update-nav', this.updateNavLinks, this);
this.on(':resize', this.handleResize, this);
this.css_tweaks.toggle('portrait', this.settings.get('layout.inject-portrait'));
this.css_tweaks.toggle('portrait-swapped', this.settings.get('layout.use-portrait-swapped'));
@ -251,6 +257,22 @@ export default class Layout extends Module {
});*/
}
handleResize() {
if ( this._resize_timer )
return;
this._resize_timer = requestAnimationFrame(() => this._handleResize());
}
_handleResize() {
cancelAnimationFrame(this._resize_timer);
this._resize_timer = null;
for(const inst of this.ResizeDetector.instances) {
inst?.props?.onResize?.();
}
}
get is_minimal() {
return this.settings.get('layout.is-minimal')
}