Commit 0e2a2f43 authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Center the popup on the X axis on the opened incidence item



Signed-off-by: Claudio Cambra's avatarClaudio Cambra <claudio.cambra@gmail.com>
parent aa151437
......@@ -155,7 +155,10 @@ Kirigami.ApplicationWindow {
}
}
KBMNavigationMouseArea { anchors.fill: parent }
KBMNavigationMouseArea {
id: kbmNavigationMouseArea
anchors.fill: parent
}
Connections {
target: KalendarApplication
......@@ -604,6 +607,8 @@ Kirigami.ApplicationWindow {
onOpeningIncidenceItemChanged: reposition()
property point incidenceItemPosition
property int incidenceItemMidXPoint: incidenceItemPosition ?
incidenceItemPosition.x + openingIncidenceItem.width / 2 : 0
property bool positionBelowIncidenceItem: incidenceItemPosition &&
incidenceItemPosition.y < root.pageStack.currentItem.height / 2;
property int maxXPosition: root.pageStack.currentItem.width - width
......@@ -626,8 +631,11 @@ Kirigami.ApplicationWindow {
function onHeightChanged() { incidenceInfoPopup.reposition(); }
}
x: Math.min(incidenceItemPosition.x, maxXPosition)
y: positionBelowIncidenceItem ? incidenceItemPosition.y + openingIncidenceItem.height : incidenceItemPosition.y - height;
// Center the popup on the incidence item if possible
x: Math.min(incidenceItemMidXPoint - width / 2, maxXPosition)
// Make sure not to cover up the incidence item
y: positionBelowIncidenceItem ?
incidenceItemPosition.y + openingIncidenceItem.height : incidenceItemPosition.y - height;
width: Kirigami.Units.gridUnit * 30
height: Math.min(Kirigami.Units.gridUnit * 50, scrollView.contentHeight)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment