Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
9f933942 by Fatih Uzunoglu at 2024-03-23T11:23:19+00:00
qml: do not show mini player when ui is scaled

- - - - -
4ef63e2a by Fatih Uzunoglu at 2024-03-23T11:23:19+00:00
qml: simplify logic in MiniPlayer.qml

- - - - -


1 changed file:

- modules/gui/qt/player/qml/MiniPlayer.qml


Changes:

=====================================
modules/gui/qt/player/qml/MiniPlayer.qml
=====================================
@@ -25,17 +25,9 @@ import "qrc:///style/"
 ControlBar {
     id: root
 
-    // Binding evaluation order:
-    // state -> implicitHeight OR visible -> anchors.bottomMargin
-    // Care must be taken to not cause binding loops.
-    visible: {
-        if (state === "inViewport")
-            return true
-        else if ((anchors.bottomMargin + implicitHeight) > Number.EPSILON)
-            return true
-        else
-            return false
-    }
+    visible: animation.running || (state === "inViewport")
+
+    anchors.bottomMargin: (state === "outViewport") ? -_delayedImplicitHeight 
: 0
 
     state: (Player.playingState === Player.PLAYING_STATE_STOPPED) ? 
"outViewport"
                                                                   : 
"inViewport"
@@ -51,27 +43,34 @@ ControlBar {
 
     identifier: PlayerControlbarModel.Miniplayer
 
-    Component.onCompleted: {
-        // Enable the behavior only when everything is resolved:
-        Qt.callLater(() => { behavior.enabled = true })
-    }
+    property real _delayedImplicitHeight
 
-    BindingCompat on anchors.bottomMargin {
-        id: binding
+    onImplicitHeightChanged: {
+        if (!animation.running) {
+            // Animation should not be based on the implicit height change
+            // but rather the visibility state:
+            behavior.enabled = false
+            Qt.callLater(() => { behavior.enabled = true })
+        }
+    }
 
+    BindingCompat on _delayedImplicitHeight {
         // eliminate intermediate adjustments until implicit height is 
calculated fully
         // we can not delay on component load because we do not want twitching
         // NOTE: The delay here can be removed, as long as a direct height is 
set
         //       for the whole control instead of implicit height.
         delayed: behavior.enabled
-
-        value: (root.state === "outViewport") ? -root.implicitHeight : 0
+        value: root.implicitHeight
     }
 
     Behavior on anchors.bottomMargin {
         id: behavior
         enabled: false
-        NumberAnimation { easing.type: Easing.InOutSine; duration: 
VLCStyle.duration_long; }
+        NumberAnimation {
+            id: animation
+            easing.type: Easing.InOutSine
+            duration: VLCStyle.duration_long
+        }
     }
 }
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/3e45f73735fce77b4ac2e9804151a1669461cabe...4ef63e2aca61cb20db56ee8a200751e08335f9dc

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/3e45f73735fce77b4ac2e9804151a1669461cabe...4ef63e2aca61cb20db56ee8a200751e08335f9dc
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to