Skip to content

Commit

Permalink
used position-changed to closes drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
ronoaer committed Sep 20, 2023
1 parent 893ec2d commit dd039a6
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions client/ui/qml/Controls2/DrawerType.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import QtQuick.Controls
Drawer {
id: drawer
property bool needCloseButton: true
property bool isOpened: false

Connections {
target: PageController
Expand Down Expand Up @@ -61,22 +62,39 @@ Drawer {
}
}

onOpened: {
isOpened = true
}

onClosed: {
isOpened = false

var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
}


onPositionChanged: {
if (isOpened && (position <= 0.99 && position >= 0.95)) {
mouseArea.canceled()
drawer.close()
mouseArea.exited()
dropArea.exited()
}
}

DropArea {
id: dropArea
}

MouseArea {
id: mouseArea
anchors.fill: parent

onCanceled: {
Drag.cancel()
drawer.close()
onPressed: {
isOpened = true
}

preventStealing: false
}
}

0 comments on commit dd039a6

Please sign in to comment.