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
|
import QtQuick.Controls
|
||||||
|
|
||||||
Drawer {
|
Drawer {
|
||||||
|
id: drawer
|
||||||
property bool needCloseButton: true
|
property bool needCloseButton: true
|
||||||
|
property bool isOpened: false
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: PageController
|
target: PageController
|
||||||
|
|
@ -60,10 +62,39 @@ Drawer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpened: {
|
||||||
|
isOpened = true
|
||||||
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
|
isOpened = false
|
||||||
|
|
||||||
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
||||||
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
||||||
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
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