Limit Drawer positioning by dragHeight and total page height

This commit is contained in:
Matthew Schwiebert 2023-09-28 10:14:01 -04:00
parent 1a8c08799f
commit 058f8b544e
2 changed files with 5 additions and 1 deletions

View file

@ -5,6 +5,7 @@ Drawer {
id: drawer
property bool needCloseButton: true
property bool isOpened: false
property int pageHeight
Connections {
target: PageController
@ -54,6 +55,7 @@ Drawer {
if (needCloseButton) {
PageController.drawerOpen()
}
position = (dragMargin / pageHeight)
}
onAboutToHide: {
@ -77,9 +79,10 @@ Drawer {
onPositionChanged: {
if (isOpened && (position <= 0.99 && position >= 0.95)) {
if (position < (dragMargin / root.height)) {
mouseArea.canceled()
drawer.close()
position = 0
mouseArea.exited()
dropArea.exited()
}

View file

@ -148,6 +148,7 @@ PageType {
width: parent.width
height: parent.height * 0.9
pageHeight: root.height
ColumnLayout {
id: serversMenuHeader