lock: move media to bottom right if small screen

This commit is contained in:
2 * r + 2 * t 2025-06-25 16:25:18 +10:00
parent 0bf32f7b8f
commit 73682163ca
3 changed files with 59 additions and 19 deletions

View file

@ -10,13 +10,15 @@ Item {
required property bool locked required property bool locked
required property real weatherWidth required property real weatherWidth
required property bool isLarge
readonly property real clockBottom: innerMask.anchors.margins + clockPath.height readonly property real clockBottom: innerMask.anchors.margins + clockPath.height
readonly property real inputTop: innerMask.anchors.margins + inputPath.height readonly property real inputTop: innerMask.anchors.margins + inputPath.height
readonly property real weatherTop: innerMask.anchors.margins + weatherPath.height readonly property real weatherTop: innerMask.anchors.margins + weatherPath.height
readonly property real weatherRight: innerMask.anchors.margins + weatherPath.width readonly property real weatherRight: innerMask.anchors.margins + weatherPath.width
readonly property real mediaBottom: innerMask.anchors.margins + mediaPath.height
readonly property real mediaRight: innerMask.anchors.margins + mediaPath.width readonly property real mediaX: innerMask.anchors.margins + mediaPath.width
readonly property real mediaY: innerMask.anchors.margins + mediaPath.height
anchors.fill: parent anchors.fill: parent
@ -277,37 +279,38 @@ Item {
strokeWidth: -1 strokeWidth: -1
fillColor: Config.border.colour fillColor: Config.border.colour
startY: height + roundingY startX: root.isLarge ? 0 : Math.ceil(innerMask.width)
startY: root.isLarge ? height + roundingY : Math.ceil(innerMask.height) - height - roundingY
PathArc { PathArc {
relativeX: mediaPath.roundingX relativeX: mediaPath.roundingX * (root.isLarge ? 1 : -1)
relativeY: -mediaPath.roundingY relativeY: mediaPath.roundingY * (root.isLarge ? -1 : 1)
radiusX: Math.min(mediaPath.rounding, mediaPath.width) radiusX: Math.min(mediaPath.rounding, mediaPath.width)
radiusY: Math.min(mediaPath.rounding, mediaPath.height) radiusY: Math.min(mediaPath.rounding, mediaPath.height)
} }
PathLine { PathLine {
relativeX: mediaPath.width - mediaPath.roundingX * 2 relativeX: (mediaPath.width - mediaPath.roundingX * 2) * (root.isLarge ? 1 : -1)
relativeY: 0 relativeY: 0
} }
PathArc { PathArc {
relativeX: mediaPath.roundingX relativeX: mediaPath.roundingX * (root.isLarge ? 1 : -1)
relativeY: -mediaPath.roundingY relativeY: mediaPath.roundingY * (root.isLarge ? -1 : 1)
radiusX: Math.min(mediaPath.rounding, mediaPath.width) radiusX: Math.min(mediaPath.rounding, mediaPath.width)
radiusY: Math.min(mediaPath.rounding, mediaPath.height) radiusY: Math.min(mediaPath.rounding, mediaPath.height)
direction: PathArc.Counterclockwise direction: PathArc.Counterclockwise
} }
PathLine { PathLine {
relativeX: 0 relativeX: 0
relativeY: -(mediaPath.height - mediaPath.roundingY * 2) relativeY: (mediaPath.height - mediaPath.roundingY * 2) * (root.isLarge ? -1 : 1)
} }
PathArc { PathArc {
relativeX: mediaPath.roundingX relativeX: mediaPath.roundingX * (root.isLarge ? 1 : -1)
relativeY: -mediaPath.roundingY relativeY: mediaPath.roundingY * (root.isLarge ? -1 : 1)
radiusX: Math.min(mediaPath.rounding, mediaPath.width) radiusX: Math.min(mediaPath.rounding, mediaPath.width)
radiusY: Math.min(mediaPath.rounding, mediaPath.height) radiusY: Math.min(mediaPath.rounding, mediaPath.height)
} }
PathLine { PathLine {
relativeX: -mediaPath.width - mediaPath.roundingX relativeX: (-mediaPath.width - mediaPath.roundingX) * (root.isLarge ? 1 : -1)
relativeY: 0 relativeY: 0
} }

View file

@ -71,6 +71,7 @@ WlSessionLockSurface {
locked: root.locked locked: root.locked
weatherWidth: weather.implicitWidth weatherWidth: weather.implicitWidth
isLarge: root.screen.width > 1920
visible: false visible: false
} }
@ -108,10 +109,41 @@ WlSessionLockSurface {
} }
MediaPlaying { MediaPlaying {
anchors.bottom: parent.top id: media
anchors.right: parent.left
anchors.bottomMargin: -backgrounds.mediaBottom isLarge: root.screen.width > 1920
anchors.rightMargin: -backgrounds.mediaRight
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
}
}
]
} }
component Anim: NumberAnimation { component Anim: NumberAnimation {

View file

@ -9,6 +9,8 @@ import QtQuick.Controls
RowLayout { RowLayout {
id: root id: root
required property bool isLarge
spacing: Appearance.spacing.large * 2 spacing: Appearance.spacing.large * 2
width: Config.lock.sizes.mediaWidth width: Config.lock.sizes.mediaWidth
@ -34,7 +36,9 @@ RowLayout {
} }
Item { Item {
Layout.bottomMargin: Config.lock.sizes.border / 2 Layout.topMargin: root.isLarge ? 0 : Config.lock.sizes.border / 2
Layout.bottomMargin: root.isLarge ? Config.lock.sizes.border / 2 : 0
Layout.leftMargin: root.isLarge ? 0 : Config.lock.sizes.border / 2
implicitWidth: Config.lock.sizes.mediaCoverSize implicitWidth: Config.lock.sizes.mediaCoverSize
implicitHeight: Config.lock.sizes.mediaCoverSize implicitHeight: Config.lock.sizes.mediaCoverSize
@ -114,8 +118,9 @@ RowLayout {
ColumnLayout { ColumnLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.bottomMargin: Config.lock.sizes.border / 2 Layout.topMargin: root.isLarge ? 0 : Config.lock.sizes.border / 2
Layout.rightMargin: Config.lock.sizes.border / 2 Layout.bottomMargin: root.isLarge ? Config.lock.sizes.border / 2 : 0
Layout.rightMargin: root.isLarge ? Config.lock.sizes.border / 2 : 0
Layout.fillWidth: true Layout.fillWidth: true
spacing: Appearance.spacing.small spacing: Appearance.spacing.small