Merge pull request #336 from amnezia-vpn/bugfix/close_drawer_easily

Bugfix/close drawer easily, short distance with dragging
This commit is contained in:
Nethius 2023-09-21 20:18:43 +05:00 committed by GitHub
commit a6d660e708
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,9 @@ import QtQuick
import QtQuick.Controls
Drawer {
id: drawer
property bool needCloseButton: true
property bool isOpened: false
Connections {
target: PageController
@ -60,10 +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
onPressed: {
isOpened = true
}
}
}