mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-10 15:38:31 -04:00
system tray: fix overflow of menus
port 1.5
(cherry picked from commit fb2dbced08)
This commit is contained in:
@@ -1752,7 +1752,11 @@ BasePill {
|
||||
id: trayMenuContainer
|
||||
|
||||
readonly property real rawWidth: Math.min(500, Math.max(250, menuColumn.implicitWidth + Theme.spacingS * 2))
|
||||
readonly property real rawHeight: Math.max(40, menuColumn.implicitHeight + Theme.spacingS * 2)
|
||||
readonly property real rawHeight: {
|
||||
const desiredHeight = Math.max(40, menuColumn.implicitHeight + Theme.spacingS * 2);
|
||||
const maxHeight = Math.max(40, menuWindow.maskHeight - 20);
|
||||
return Math.min(desiredHeight, maxHeight);
|
||||
}
|
||||
|
||||
readonly property real alignedWidth: Theme.px(rawWidth, menuWindow.dpr)
|
||||
readonly property real alignedHeight: Theme.px(rawHeight, menuWindow.dpr)
|
||||
@@ -1852,13 +1856,19 @@ BasePill {
|
||||
}
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
id: menuFlickable
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.spacingS
|
||||
contentWidth: width
|
||||
contentHeight: menuColumn.implicitHeight
|
||||
clip: true
|
||||
interactive: contentHeight > height
|
||||
|
||||
Column {
|
||||
id: menuColumn
|
||||
|
||||
width: parent.width - Theme.spacingS * 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Theme.spacingS
|
||||
width: menuFlickable.width
|
||||
spacing: 1
|
||||
|
||||
Rectangle {
|
||||
@@ -1881,7 +1891,7 @@ BasePill {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
elide: Text.ElideMiddle
|
||||
width: parent.width - Theme.spacingS * 2 - 24
|
||||
width: parent.width - Theme.spacingS * 2 - (Theme.iconSizeSmall + Theme.spacingS)
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
@@ -1893,7 +1903,7 @@ BasePill {
|
||||
return "push_pin";
|
||||
return root.isManualHiddenTrayItem(menuRoot.trayItem) ? "visibility" : "visibility_off";
|
||||
}
|
||||
size: 16
|
||||
size: Theme.iconSizeSmall
|
||||
color: Theme.widgetTextColor
|
||||
}
|
||||
|
||||
@@ -1940,7 +1950,7 @@ BasePill {
|
||||
|
||||
DankIcon {
|
||||
name: "arrow_back"
|
||||
size: 16
|
||||
size: Theme.iconSizeSmall
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@@ -2018,11 +2028,11 @@ BasePill {
|
||||
visible: !menuEntry?.isSeparator
|
||||
|
||||
Rectangle {
|
||||
width: 16
|
||||
height: 16
|
||||
width: Theme.iconSizeSmall
|
||||
height: Theme.iconSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: menuEntry?.buttonType !== undefined && menuEntry.buttonType !== 0
|
||||
radius: menuEntry?.buttonType === 2 ? 8 : 2
|
||||
radius: menuEntry?.buttonType === 2 ? width / 2 : 2
|
||||
border.width: 1
|
||||
border.color: Theme.outline
|
||||
color: "transparent"
|
||||
@@ -2039,23 +2049,23 @@ BasePill {
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "check"
|
||||
size: 10
|
||||
size: Theme.iconSizeSmall - 6
|
||||
color: Theme.primaryText
|
||||
visible: menuEntry?.buttonType === 1 && menuEntry?.checkState === 2
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 16
|
||||
height: 16
|
||||
width: Theme.iconSizeSmall
|
||||
height: Theme.iconSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: (menuEntry?.icon ?? "") !== ""
|
||||
|
||||
Image {
|
||||
anchors.fill: parent
|
||||
source: menuEntry?.icon || ""
|
||||
sourceSize.width: 16
|
||||
sourceSize.height: 16
|
||||
sourceSize.width: Theme.iconSizeSmall
|
||||
sourceSize.height: Theme.iconSizeSmall
|
||||
fillMode: Image.PreserveAspectFit
|
||||
smooth: true
|
||||
}
|
||||
@@ -2072,14 +2082,14 @@ BasePill {
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 16
|
||||
height: 16
|
||||
width: Theme.iconSizeSmall
|
||||
height: Theme.iconSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "chevron_right"
|
||||
size: 14
|
||||
size: Theme.iconSizeSmall - 2
|
||||
color: Theme.widgetTextColor
|
||||
visible: menuEntry?.hasChildren ?? false
|
||||
}
|
||||
@@ -2092,6 +2102,7 @@ BasePill {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
|
||||
if (!screen)
|
||||
|
||||
Reference in New Issue
Block a user