actiondrawer: Use simpler and more performant widescreen panel logic without clipping

This commit is contained in:
Devin Lin 2022-12-06 19:01:42 -05:00
parent 79798d57e7
commit 6314aaf4ae
3 changed files with 19 additions and 15 deletions

View file

@ -173,7 +173,7 @@ PlasmaCore.ColorScope {
// right sidebar
QuickSettingsPanel {
id: quickSettings
height: Math.min(root.height, Math.max(quickSettings.minimizedHeight, actionDrawer.offset))
height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding
width: intendedWidth
readonly property real intendedWidth: 360
@ -182,11 +182,12 @@ PlasmaCore.ColorScope {
anchors.right: parent.right
actionDrawer: root.actionDrawer
fullHeight: root.height
fullScreenHeight: root.height
transform: Translate {
id: translate
y: Math.min(root.actionDrawer.offset - quickSettings.minimizedHeight, 0)
property real offsetRatio: quickSettings.height / root.height
y: Math.min(root.actionDrawer.offset * offsetRatio - quickSettings.height, 0)
}
}
}

View file

@ -48,9 +48,18 @@ Item {
readonly property int rowCount: {
let totalRows = Math.ceil(quickSettingsCount / columnCount);
let isPortrait = MobileShellState.Shell.orientation === MobileShellState.Shell.Portrait;
let maxRows = 5; // more than 5 is just disorienting
let targetRows = Math.floor(Window.height * (isPortrait ? 0.65 : 0.8) / rowHeight);
return Math.min(maxRows, Math.min(totalRows, targetRows));
if (isPortrait) {
// portrait orientation
let maxRows = 5; // more than 5 is just disorienting
let targetRows = Math.floor(Window.height * 0.65 / rowHeight);
return Math.min(maxRows, Math.min(totalRows, targetRows));
} else {
// horizontal orientation
let targetRows = Math.floor(Window.height * 0.8 / rowHeight);
return Math.min(totalRows, targetRows);
}
}
readonly property int pageSize: rowCount * columnCount

View file

@ -28,12 +28,7 @@ Components.BaseItem {
required property var actionDrawer
required property real fullHeight
/**
* Height of panel when first pulled down.
*/
readonly property real minimizedHeight: bottomPadding + topPadding + statusBar.height + quickSettings.rowHeight
required property real fullScreenHeight
/**
* Implicit height of the contents of the panel.
@ -53,7 +48,6 @@ Components.BaseItem {
contentItem: Item {
id: containerItem
clip: true
// use container item so that our column doesn't get stretched if base item is anchored
ColumnLayout {
@ -61,7 +55,7 @@ Components.BaseItem {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: root.fullHeight
height: root.fullScreenHeight
spacing: 0
StatusBar.StatusBar {
@ -89,7 +83,7 @@ Components.BaseItem {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.maximumHeight: root.fullHeight - root.topPadding - root.bottomPadding - statusBar.height - PlasmaCore.Units.smallSpacing
Layout.maximumHeight: root.fullScreenHeight - root.topPadding - root.bottomPadding - statusBar.height - PlasmaCore.Units.smallSpacing
Layout.maximumWidth: column.width
actionDrawer: root.actionDrawer