mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-29 14:37:47 -04:00
launcher: fix grid display
port 2.0
This commit is contained in:
1 parent
fc7c92f8b2
commit
8827aa0041
3 files changed
+11
-17
No files matched your search
@@ -103,8 +103,7 @@ Item {
|
||||
readonly property int baseHeight: LauncherMetrics.sizeHeight(_dmenuSizeOverride || SettingsData.dankLauncherV2Size)
|
||||
readonly property real _contentImplicitH: launcherContentLoader.item?.implicitHeight ?? LauncherMetrics.pillHeight
|
||||
readonly property int modalWidth: Math.min(spotlight ? (_dmenuSizeOverride ? LauncherMetrics.sizeWidth(_dmenuSizeOverride) : LauncherMetrics.spotlightWidth) : baseWidth, screenWidth - LauncherMetrics.screenMargin)
|
||||
readonly property int clampedBaseHeight: Math.min(baseHeight, screenHeight - LauncherMetrics.screenMargin)
|
||||
readonly property int modalHeight: spotlight ? _contentImplicitH : clampedBaseHeight - (launcherContentLoader.item?.surplusHeight ?? 0)
|
||||
readonly property int modalHeight: spotlight ? _contentImplicitH : Math.min(baseHeight, screenHeight - LauncherMetrics.screenMargin)
|
||||
|
||||
readonly property string preferredConnectedBarSide: SettingsData.frameLauncherEmergeSide
|
||||
|
||||
@@ -897,7 +896,6 @@ Item {
|
||||
focus: true
|
||||
parentModal: root
|
||||
transientSurfaceTracker: transientSurfaces
|
||||
baseHeight: root.clampedBaseHeight
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,6 @@ FocusScope {
|
||||
property var parentModal: null
|
||||
property string viewModeContext: "spotlight"
|
||||
property alias searchField: searchField
|
||||
property real baseHeight: height
|
||||
readonly property real baseChromeHeight: Theme.spacingM + searchRow.height + mesgRow.height + contentStack.anchors.topMargin + contentStack.anchors.bottomMargin + (categoryRow.visible ? categoryRow.height + contentStack.gap : 0) + (fileFilterRow.visible ? fileFilterRow.height + contentStack.gap : 0) + footerBar.height + (footerBar.showFooter || contentHolder.inverted ? 0 : Theme.spacingM) + (contentHolder.inverted || footerBar._connectedBottomEmerge ? 0 : (root.parentModal?.borderWidth ?? 1))
|
||||
readonly property real surplusHeight: {
|
||||
const pitch = LauncherMetrics.rowHeight + LauncherMetrics.rowGap;
|
||||
const available = baseHeight - baseChromeHeight - LauncherMetrics.sectionBand;
|
||||
const rows = Math.max(0, Math.floor((available + 1) / pitch));
|
||||
return Math.max(0, Math.round(available - rows * pitch));
|
||||
}
|
||||
property alias controller: controller
|
||||
property alias resultsList: resultsList
|
||||
property alias actionPanel: actionPanel
|
||||
@@ -682,12 +674,8 @@ FocusScope {
|
||||
id: resultsList
|
||||
focusReturnTarget: searchField
|
||||
keyForwardTargets: [root]
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: contentHolder.inverted ? undefined : parent.top
|
||||
anchors.bottom: contentHolder.inverted ? parent.bottom : undefined
|
||||
availableHeight: parent.height + (actionPanel.height > 0 ? actionPanel.height + contentStack.gap : 0)
|
||||
height: Math.min(fittedHeight, parent.height)
|
||||
anchors.fill: parent
|
||||
fitGridRows: true
|
||||
controller: root.controller
|
||||
leadingSectionHeaderAtBottom: contentHolder.inverted
|
||||
transientSurfaceTracker: root.transientSurfaceTracker
|
||||
|
||||
@@ -33,6 +33,7 @@ Item {
|
||||
readonly property real contentHeight: _visualModel.height
|
||||
readonly property int pageRows: Math.max(1, Math.floor(height / (LauncherMetrics.rowHeight + LauncherMetrics.rowGap)))
|
||||
property real availableHeight: 0
|
||||
property bool fitGridRows: false
|
||||
readonly property real fittedHeight: {
|
||||
const rows = _visualModel.rows;
|
||||
const starts = _visualModel.heights;
|
||||
@@ -125,6 +126,9 @@ Item {
|
||||
var cols = root.controller?.getGridColumns(sectionId) ?? root.gridColumns;
|
||||
var cellWidth = Math.floor(root.width / cols);
|
||||
var cellHeight = mode === "tile" ? cellWidth * LauncherMetrics.tileImageRatio : cellWidth + LauncherMetrics.tileLabelHeight;
|
||||
var gridSpace = root.height - sectionBand;
|
||||
if (root.fitGridRows && mode === "grid" && gridSpace > 0)
|
||||
cellHeight = gridSpace / Math.max(1, Math.round(gridSpace / cellHeight));
|
||||
var numRows = Math.ceil(items.length / cols);
|
||||
|
||||
for (var r = 0; r < numRows; r++) {
|
||||
@@ -190,6 +194,10 @@ Item {
|
||||
|
||||
onGridColumnsChanged: rebuildTimer.restart()
|
||||
onWidthChanged: rebuildTimer.restart()
|
||||
onHeightChanged: {
|
||||
if (fitGridRows)
|
||||
rebuildTimer.restart();
|
||||
}
|
||||
onLeadingSectionHeaderAtBottomChanged: rebuildTimer.restart()
|
||||
|
||||
Connections {
|
||||
|
||||
Reference in new issue
Block a user