mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
Add custom drawer behavior to pageHome, for mobile and desktop
This commit is contained in:
@@ -5,7 +5,6 @@ Drawer {
|
||||
id: drawer
|
||||
property bool needCloseButton: true
|
||||
property bool isOpened: false
|
||||
property int pageHeight
|
||||
|
||||
Connections {
|
||||
target: PageController
|
||||
@@ -51,26 +50,23 @@ Drawer {
|
||||
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
|
||||
PageController.updateNavigationBarColor(0xFF1C1D21)
|
||||
}
|
||||
|
||||
if (needCloseButton) {
|
||||
PageController.drawerOpen()
|
||||
}
|
||||
position = (dragMargin / pageHeight)
|
||||
}
|
||||
|
||||
onAboutToHide: {
|
||||
if (needCloseButton) {
|
||||
PageController.drawerClose()
|
||||
}
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
isOpened = true
|
||||
|
||||
if (needCloseButton) {
|
||||
PageController.drawerOpen()
|
||||
}
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
isOpened = false
|
||||
|
||||
if (needCloseButton) {
|
||||
PageController.drawerClose()
|
||||
}
|
||||
|
||||
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
||||
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
||||
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
||||
@@ -79,10 +75,9 @@ Drawer {
|
||||
|
||||
|
||||
onPositionChanged: {
|
||||
if (position < (dragMargin / root.height)) {
|
||||
if (isOpened && (position <= 0.99 && position >= 0.95)) {
|
||||
mouseArea.canceled()
|
||||
drawer.close()
|
||||
position = 0
|
||||
mouseArea.exited()
|
||||
dropArea.exited()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user