navigationpanel: Properly cap width for wide screens

This commit is contained in:
Devin Lin 2022-06-27 17:28:41 -04:00
parent eff9d3df9a
commit 5519abd82c

View file

@ -173,20 +173,19 @@ Item {
when: root.width < root.height when: root.width < root.height
PropertyChanges { PropertyChanges {
target: icons target: icons
buttonLength: icons.height * 0.8 / 3 buttonLength: Math.min(PlasmaCore.Units.gridUnit * 10, icons.height * 0.9 / 3)
} }
AnchorChanges { AnchorChanges {
target: leftButton target: leftButton
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
top: parent.top top: middleButton.bottom
} }
} }
PropertyChanges { PropertyChanges {
target: leftButton target: leftButton
width: parent.width width: parent.width
height: icons.buttonLength height: icons.buttonLength
anchors.topMargin: parent.height * 0.1
} }
PropertyChanges { PropertyChanges {
target: middleButton target: middleButton
@ -197,34 +196,32 @@ Item {
target: rightButton target: rightButton
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
bottom: parent.bottom bottom: middleButton.top
} }
} }
PropertyChanges { PropertyChanges {
target: rightButton target: rightButton
height: icons.buttonLength height: icons.buttonLength
width: icons.width width: icons.width
anchors.bottomMargin: parent.height * 0.1
} }
}, State { }, State {
name: "portrait" name: "portrait"
when: root.width >= root.height when: root.width >= root.height
PropertyChanges { PropertyChanges {
target: icons target: icons
buttonLength: icons.width * 0.8 / 3 buttonLength: Math.min(PlasmaCore.Units.gridUnit * 8, icons.width * 0.9 / 3)
} }
AnchorChanges { AnchorChanges {
target: leftButton target: leftButton
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left right: middleButton.left
} }
} }
PropertyChanges { PropertyChanges {
target: leftButton target: leftButton
height: parent.height height: parent.height
width: icons.buttonLength width: icons.buttonLength
anchors.leftMargin: parent.width * 0.1
} }
PropertyChanges { PropertyChanges {
target: middleButton target: middleButton
@ -235,14 +232,13 @@ Item {
target: rightButton target: rightButton
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right left: middleButton.right
} }
} }
PropertyChanges { PropertyChanges {
target: rightButton target: rightButton
height: parent.height height: parent.height
width: icons.buttonLength width: icons.buttonLength
anchors.rightMargin: parent.width * 0.1
} }
} }
] ]