Merge pull request #336 from amnezia-vpn/bugfix/close_drawer_easily
Bugfix/close drawer easily, short distance with dragging
This commit is contained in:
commit
a6d660e708
1 changed files with 31 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue