mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
Do not show mobile controls transition on launch
Start app with the correct controls layout instead of showing the "hide elapsed time" transition when started on mobile width. It is annoying. We cannot detect surface width during app widgets assembly, so update the controls revealers state on first surface update after window is mapped and only if running on mobile width. Otherwise do not do anything like before which will result in showing fully revealed controls (default).
This commit is contained in:
4
src/controls.js
vendored
4
src/controls.js
vendored
@@ -18,6 +18,8 @@ class ClapperControls extends Gtk.Box
|
||||
can_focus: false,
|
||||
});
|
||||
|
||||
this.minFullViewWidth = 560;
|
||||
|
||||
this.currentPosition = 0;
|
||||
this.currentDuration = 0;
|
||||
this.isPositionDragging = false;
|
||||
@@ -473,7 +475,7 @@ class ClapperControls extends Gtk.Box
|
||||
|
||||
_onPlayerResize(width, height)
|
||||
{
|
||||
const isMobile = (width < 560);
|
||||
const isMobile = (width < this.minFullViewWidth);
|
||||
if(this.isMobile === isMobile)
|
||||
return;
|
||||
|
||||
|
@@ -370,6 +370,18 @@ class ClapperButtonsRevealer extends Gtk.Revealer
|
||||
this.get_child().append(widget);
|
||||
}
|
||||
|
||||
revealInstantly(isReveal)
|
||||
{
|
||||
if(this.child_revealed === isReveal)
|
||||
return;
|
||||
|
||||
const initialDuration = this.transition_duration;
|
||||
|
||||
this.transition_duration = 0;
|
||||
this.reveal_child = isReveal;
|
||||
this.transition_duration = initialDuration;
|
||||
}
|
||||
|
||||
_setRotateClass(icon, isAdd)
|
||||
{
|
||||
const cssClass = 'halfrotate';
|
||||
@@ -388,7 +400,8 @@ class ClapperButtonsRevealer extends Gtk.Revealer
|
||||
|
||||
_onRevealChild(button)
|
||||
{
|
||||
this._setRotateClass(button.child, true);
|
||||
if(this.reveal_child !== this.child_revealed)
|
||||
this._setRotateClass(button.child, true);
|
||||
}
|
||||
|
||||
_onChildRevealed(button)
|
||||
|
@@ -541,6 +541,12 @@ class ClapperWidget extends Gtk.Grid
|
||||
if(width === this.layoutWidth)
|
||||
return;
|
||||
|
||||
/* Launch without showing revealers transitions on mobile width */
|
||||
if(!this.layoutWidth && width < this.controls.minFullViewWidth) {
|
||||
for(let revealer of this.controls.revealersArr)
|
||||
revealer.revealInstantly(false);
|
||||
}
|
||||
|
||||
this.layoutWidth = width;
|
||||
|
||||
if(this.isFullscreenMode)
|
||||
|
Reference in New Issue
Block a user