forked from Shinonome/dots-hyprland
actually fixing popup content spacing this time
This commit is contained in:
+9
-11
@@ -27,15 +27,11 @@ Shapes.ShapeCanvas {
|
|||||||
required property real startRadius
|
required property real startRadius
|
||||||
required property real endRadius
|
required property real endRadius
|
||||||
property real baseMargin: {
|
property real baseMargin: {
|
||||||
print("calculating new base margin (vertical, parent height, container height) = ", vertical, parent.height, containerShape.height)
|
|
||||||
if (!vertical)
|
if (!vertical)
|
||||||
return parent.anchors.topMargin
|
return parent.anchors.topMargin
|
||||||
else
|
else
|
||||||
return parent.anchors.leftMargin
|
return parent.anchors.leftMargin
|
||||||
}
|
}
|
||||||
onBaseMarginChanged: {
|
|
||||||
print(baseMargin)
|
|
||||||
}
|
|
||||||
|
|
||||||
property alias containerShape: containerShape
|
property alias containerShape: containerShape
|
||||||
property alias popupShape: popupShape
|
property alias popupShape: popupShape
|
||||||
@@ -88,16 +84,18 @@ Shapes.ShapeCanvas {
|
|||||||
onPopupYOffsetChanged: if (bgShape.showPopup) lockPopupY = true;
|
onPopupYOffsetChanged: if (bgShape.showPopup) lockPopupY = true;
|
||||||
|
|
||||||
// Positioning
|
// Positioning
|
||||||
readonly property real popupContentOffsetBase: popupPadding + baseMargin
|
readonly property real popupContentOffsetBase: popupPadding
|
||||||
|
readonly property real popupContentOffsetBaseX: popupContentOffsetBase + parent.anchors.leftMargin
|
||||||
|
readonly property real popupContentOffsetBaseY: popupContentOffsetBase + parent.anchors.topMargin
|
||||||
readonly property real paddedContainerHeight: containerShape.height
|
readonly property real paddedContainerHeight: containerShape.height
|
||||||
readonly property real paddedContainerWidth: containerShape.width
|
readonly property real paddedContainerWidth: containerShape.width
|
||||||
readonly property real popupContentOffsetY: {
|
|
||||||
if (!vertical) return paddedContainerHeight + spacing + popupContentOffsetBase + (atBottom * -(popupHeight + backgroundHeight + spacing * 2))
|
|
||||||
else return popupYOffset + popupContentOffsetBase;
|
|
||||||
}
|
|
||||||
readonly property real popupContentOffsetX: {
|
readonly property real popupContentOffsetX: {
|
||||||
if (!vertical) return popupXOffset + popupContentOffsetBase;
|
if (!vertical) return popupXOffset + popupContentOffsetBaseX;
|
||||||
else return paddedContainerWidth + spacing + popupContentOffsetBase + (atBottom * -(popupWidth + backgroundWidth + spacing * 2));
|
else return paddedContainerWidth + spacing + popupContentOffsetBaseX + (atBottom * -(popupWidth + backgroundWidth + spacing * 2));
|
||||||
|
}
|
||||||
|
readonly property real popupContentOffsetY: {
|
||||||
|
if (!vertical) return paddedContainerHeight + spacing + popupContentOffsetBaseY + (atBottom * -(popupHeight + backgroundHeight + spacing * 2))
|
||||||
|
else return popupYOffset + popupContentOffsetBaseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|||||||
@@ -21,13 +21,14 @@ HBarWidgetWithPopout {
|
|||||||
|
|
||||||
HBarWidgetContent {
|
HBarWidgetContent {
|
||||||
id: contentRoot
|
id: contentRoot
|
||||||
|
|
||||||
vertical: root.vertical
|
vertical: root.vertical
|
||||||
atBottom: root.atBottom
|
atBottom: root.atBottom
|
||||||
showPopup: root.showPopup
|
showPopup: root.showPopup
|
||||||
contentImplicitWidth: activeItem.implicitWidth
|
|
||||||
contentImplicitHeight: activeItem.implicitHeight
|
|
||||||
onClicked: root.showPopup = !root.showPopup
|
onClicked: root.showPopup = !root.showPopup
|
||||||
property var activeItem: sysInfoContent
|
|
||||||
|
contentImplicitWidth: sysInfoContent.implicitWidth
|
||||||
|
contentImplicitHeight: sysInfoContent.implicitHeight
|
||||||
|
|
||||||
SysInfoContent {
|
SysInfoContent {
|
||||||
id: sysInfoContent
|
id: sysInfoContent
|
||||||
@@ -37,9 +38,9 @@ HBarWidgetWithPopout {
|
|||||||
SysInfoPopupContent {
|
SysInfoPopupContent {
|
||||||
id: popupContent
|
id: popupContent
|
||||||
anchors {
|
anchors {
|
||||||
top: root.vertical ? contentRoot.activeItem.top : contentRoot.activeItem.top
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
topMargin: root.popupContentOffsetY
|
topMargin: root.popupContentOffsetY
|
||||||
left: root.vertical ? contentRoot.activeItem.left : contentRoot.activeItem.left
|
|
||||||
leftMargin: root.popupContentOffsetX
|
leftMargin: root.popupContentOffsetX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ HBarWidgetWithPopout {
|
|||||||
PopupContent {
|
PopupContent {
|
||||||
id: popupContent
|
id: popupContent
|
||||||
anchors {
|
anchors {
|
||||||
top: root.vertical ? verticalContent.top : horizontalContent.top
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
topMargin: root.popupContentOffsetY
|
topMargin: root.popupContentOffsetY
|
||||||
left: root.vertical ? verticalContent.left : horizontalContent.left
|
|
||||||
leftMargin: root.popupContentOffsetX
|
leftMargin: root.popupContentOffsetX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user