Reduce amount of logic in controls unreveal tick

This commit is contained in:
Rafał Dzięgiel
2021-02-13 18:20:17 +01:00
parent 1d16d3e2ac
commit 662517163b

View File

@@ -260,10 +260,16 @@ class ClapperControlsRevealer extends Gtk.Revealer
const { widget } = this.root.child.player; const { widget } = this.root.child.player;
if(!this.child_revealed) if(this.child_revealed) {
this.visible = true; const [width] = this.root.get_default_size();
const height = widget.get_height();
this.add_tick_callback(
this._onUnrevealTick.bind(this, widget, width, height)
);
}
else else
this.add_tick_callback(this._onUnrevealTick.bind(this, widget)); this.visible = true;
widget.height_request = widget.get_height(); widget.height_request = widget.get_height();
this.reveal_child ^= true; this.reveal_child ^= true;
@@ -280,18 +286,17 @@ class ClapperControlsRevealer extends Gtk.Revealer
} }
} }
_onUnrevealTick(playerWidget) _onUnrevealTick(playerWidget, width, height)
{ {
const [width, height] = this.root.get_default_size(); const isRevealed = this.child_revealed;
if(!this.child_revealed) { if(!isRevealed) {
playerWidget.height_request = -1; playerWidget.height_request = -1;
this.visible = false; this.visible = false;
} }
this.root.set_default_size(width, height);
this.root.set_default_size(width, playerWidget.get_height()); return isRevealed;
return this.child_revealed;
} }
}); });