mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Reduce amount of logic in controls unreveal tick
This commit is contained in:
@@ -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;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user