From e79895b8f2c2b071e1af889247c3dd26a314aad9 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:56:07 +1000 Subject: lock: completely hide media if screen too small --- modules/lock/LockSurface.qml | 78 ++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 35 deletions(-) (limited to 'modules/lock/LockSurface.qml') diff --git a/modules/lock/LockSurface.qml b/modules/lock/LockSurface.qml index 423d29d..084c275 100644 --- a/modules/lock/LockSurface.qml +++ b/modules/lock/LockSurface.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import "root:/widgets" import "root:/services" import "root:/config" @@ -71,6 +73,7 @@ WlSessionLockSurface { locked: root.locked weatherWidth: weather.implicitWidth + isNormal: root.screen.width > Config.lock.sizes.smallScreenWidth isLarge: root.screen.width > Config.lock.sizes.largeScreenWidth visible: false } @@ -108,42 +111,47 @@ WlSessionLockSurface { anchors.rightMargin: -backgrounds.weatherRight } - MediaPlaying { - id: media - - isLarge: root.screen.width > Config.lock.sizes.largeScreenWidth - - state: isLarge ? "tl" : "br" - states: [ - State { - name: "tl" - - AnchorChanges { - target: media - anchors.bottom: media.parent.top - anchors.right: media.parent.left + Loader { + active: root.screen.width > Config.lock.sizes.smallScreenWidth + asynchronous: true + + sourceComponent: MediaPlaying { + id: media + + isLarge: root.screen.width > Config.lock.sizes.largeScreenWidth + + state: isLarge ? "tl" : "br" + states: [ + State { + name: "tl" + + AnchorChanges { + target: media + anchors.bottom: media.parent.top + anchors.right: media.parent.left + } + + PropertyChanges { + media.anchors.bottomMargin: -backgrounds.mediaY + media.anchors.rightMargin: -backgrounds.mediaX + } + }, + State { + name: "br" + + AnchorChanges { + target: media + anchors.top: media.parent.bottom + anchors.left: media.parent.right + } + + PropertyChanges { + media.anchors.topMargin: -backgrounds.mediaY + media.anchors.leftMargin: -backgrounds.mediaX + } } - - PropertyChanges { - media.anchors.bottomMargin: -backgrounds.mediaY - media.anchors.rightMargin: -backgrounds.mediaX - } - }, - State { - name: "br" - - AnchorChanges { - target: media - anchors.top: media.parent.bottom - anchors.left: media.parent.right - } - - PropertyChanges { - media.anchors.topMargin: -backgrounds.mediaY - media.anchors.leftMargin: -backgrounds.mediaX - } - } - ] + ] + } } component Anim: NumberAnimation { -- cgit v1.2.3-freya