1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 21:45:38 -05:00

Make popups relative based on top bar position

This commit is contained in:
bbedward
2025-08-04 23:42:35 -04:00
parent ccd9f00201
commit 16e3b18e8e
14 changed files with 288 additions and 19 deletions

View File

@@ -7,6 +7,8 @@ Rectangle {
id: root
property bool isActive: false
property string section: "left" // Which section this button is in
property var popupTarget: null // Reference to the popup to position
signal clicked()
@@ -42,7 +44,14 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
onClicked: {
if (popupTarget && popupTarget.setTriggerPosition) {
var globalPos = mapToGlobal(0, 0);
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
}
root.clicked();
}
}
Behavior on color {