mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 17:54:45 +00:00
actiondrawer: Use simpler and more performant widescreen panel logic without clipping
This commit is contained in:
parent
79798d57e7
commit
6314aaf4ae
3 changed files with 19 additions and 15 deletions
|
|
@ -173,7 +173,7 @@ PlasmaCore.ColorScope {
|
||||||
// right sidebar
|
// right sidebar
|
||||||
QuickSettingsPanel {
|
QuickSettingsPanel {
|
||||||
id: quickSettings
|
id: quickSettings
|
||||||
height: Math.min(root.height, Math.max(quickSettings.minimizedHeight, actionDrawer.offset))
|
height: quickSettings.contentImplicitHeight + quickSettings.topPadding + quickSettings.bottomPadding
|
||||||
width: intendedWidth
|
width: intendedWidth
|
||||||
|
|
||||||
readonly property real intendedWidth: 360
|
readonly property real intendedWidth: 360
|
||||||
|
|
@ -182,11 +182,12 @@ PlasmaCore.ColorScope {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
actionDrawer: root.actionDrawer
|
actionDrawer: root.actionDrawer
|
||||||
fullHeight: root.height
|
fullScreenHeight: root.height
|
||||||
|
|
||||||
transform: Translate {
|
transform: Translate {
|
||||||
id: 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,18 @@ Item {
|
||||||
readonly property int rowCount: {
|
readonly property int rowCount: {
|
||||||
let totalRows = Math.ceil(quickSettingsCount / columnCount);
|
let totalRows = Math.ceil(quickSettingsCount / columnCount);
|
||||||
let isPortrait = MobileShellState.Shell.orientation === MobileShellState.Shell.Portrait;
|
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);
|
if (isPortrait) {
|
||||||
return Math.min(maxRows, Math.min(totalRows, targetRows));
|
// 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
|
readonly property int pageSize: rowCount * columnCount
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,7 @@ Components.BaseItem {
|
||||||
|
|
||||||
required property var actionDrawer
|
required property var actionDrawer
|
||||||
|
|
||||||
required property real fullHeight
|
required property real fullScreenHeight
|
||||||
|
|
||||||
/**
|
|
||||||
* Height of panel when first pulled down.
|
|
||||||
*/
|
|
||||||
readonly property real minimizedHeight: bottomPadding + topPadding + statusBar.height + quickSettings.rowHeight
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implicit height of the contents of the panel.
|
* Implicit height of the contents of the panel.
|
||||||
|
|
@ -53,7 +48,6 @@ Components.BaseItem {
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
id: containerItem
|
id: containerItem
|
||||||
clip: true
|
|
||||||
|
|
||||||
// use container item so that our column doesn't get stretched if base item is anchored
|
// use container item so that our column doesn't get stretched if base item is anchored
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
@ -61,7 +55,7 @@ Components.BaseItem {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
height: root.fullHeight
|
height: root.fullScreenHeight
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
StatusBar.StatusBar {
|
StatusBar.StatusBar {
|
||||||
|
|
@ -89,7 +83,7 @@ Components.BaseItem {
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
Layout.fillWidth: true
|
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
|
Layout.maximumWidth: column.width
|
||||||
|
|
||||||
actionDrawer: root.actionDrawer
|
actionDrawer: root.actionDrawer
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue