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:
Rafał Dzięgiel
2021-04-15 15:27:21 +02:00
parent ca7b44092e
commit b02f54a3a6
3 changed files with 23 additions and 2 deletions

4
src/controls.js vendored
View File

@@ -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;

View File

@@ -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)

View File

@@ -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)