Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kalendar
Commits
0e2a2f43
Commit
0e2a2f43
authored
Sep 07, 2022
by
Claudio Cambra
Browse files
Center the popup on the X axis on the opened incidence item
Signed-off-by:
Claudio Cambra
<
claudio.cambra@gmail.com
>
parent
aa151437
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/main.qml
View file @
0e2a2f43
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment