Add custom drawer behavior to pageHome, for mobile and desktop
This commit is contained in:
parent
058f8b544e
commit
3d999a503c
2 changed files with 121 additions and 58 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue