Merge branch 'fix/drawerTypePositioning' of github.com:amnezia-vpn/amnezia-client into fix/drawerTypePositioning
This commit is contained in:
commit
b1e9e8677b
2 changed files with 10 additions and 0 deletions
|
@ -52,12 +52,16 @@ Drawer {
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
|
isOpened = true
|
||||||
|
|
||||||
if (needCloseButton) {
|
if (needCloseButton) {
|
||||||
PageController.drawerOpen()
|
PageController.drawerOpen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
|
isOpened = false
|
||||||
|
|
||||||
if (needCloseButton) {
|
if (needCloseButton) {
|
||||||
PageController.drawerClose()
|
PageController.drawerClose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ PageType {
|
||||||
drag.maximumY: root.height - buttonContent.collapsedHeight
|
drag.maximumY: root.height - buttonContent.collapsedHeight
|
||||||
drag.minimumY: root.height - root.height * 0.9
|
drag.minimumY: root.height - root.height * 0.9
|
||||||
|
|
||||||
|
/** If drag area is released at any point other than min or max y, transition to the other state */
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) {
|
if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) {
|
||||||
buttonContent.state = "expanded"
|
buttonContent.state = "expanded"
|
||||||
|
@ -110,8 +111,11 @@ PageType {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: buttonContent
|
id: buttonContent
|
||||||
|
|
||||||
|
/** Initial height of button content */
|
||||||
property int collapsedHeight: 0
|
property int collapsedHeight: 0
|
||||||
|
/** True when expanded objects should be visible */
|
||||||
property bool expandedVisibility: buttonContent.state === "expanded" || (buttonContent.state === "collapsed" && dragArea.drag.active === true)
|
property bool expandedVisibility: buttonContent.state === "expanded" || (buttonContent.state === "collapsed" && dragArea.drag.active === true)
|
||||||
|
/** True when collapsed objects should be visible */
|
||||||
property bool collapsedVisibility: buttonContent.state === "collapsed" && dragArea.drag.active === false
|
property bool collapsedVisibility: buttonContent.state === "collapsed" && dragArea.drag.active === false
|
||||||
|
|
||||||
Drag.active: dragArea.drag.active
|
Drag.active: dragArea.drag.active
|
||||||
|
@ -123,6 +127,7 @@ PageType {
|
||||||
buttonContent.state = "collapsed"
|
buttonContent.state = "collapsed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set once based on first implicit height change once all children are layed out */
|
||||||
onImplicitHeightChanged: {
|
onImplicitHeightChanged: {
|
||||||
if (buttonContent.state === "collapsed" && collapsedHeight == 0) {
|
if (buttonContent.state === "collapsed" && collapsedHeight == 0) {
|
||||||
collapsedHeight = implicitHeight
|
collapsedHeight = implicitHeight
|
||||||
|
@ -147,6 +152,7 @@ PageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Two states of buttonContent, great place to add any future animations for the drawer */
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "collapsed"
|
name: "collapsed"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue