adapted pagehome by new custom drawer type
This commit is contained in:
parent
cb5c09d967
commit
7cc0f39d3c
6 changed files with 194 additions and 268 deletions
|
@ -22,10 +22,9 @@ Item {
|
|||
|
||||
property string defaultColor: "#1C1D21"
|
||||
property string borderColor: "#2C2D30"
|
||||
property int collapsedHeight: 0
|
||||
|
||||
property bool needCollapsed: false
|
||||
property double scaely
|
||||
|
||||
property int contentHeight: 0
|
||||
property Item contentParent: contentArea
|
||||
|
||||
|
@ -50,15 +49,10 @@ Item {
|
|||
MouseArea {
|
||||
id: fullArea
|
||||
anchors.fill: parent
|
||||
enabled: (root.state === "expanded" || root.state === "opened")
|
||||
enabled: (root.state === "opened")
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: {
|
||||
if (root.state === "expanded") {
|
||||
root.state = "collapsed"
|
||||
return
|
||||
}
|
||||
|
||||
if (root.state === "opened") {
|
||||
root.state = "closed"
|
||||
return
|
||||
|
@ -101,7 +95,7 @@ Item {
|
|||
|
||||
anchors.fill: parent
|
||||
|
||||
cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
cursorShape: (root.state === "opened") ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
hoverEnabled: true
|
||||
|
||||
drag.target: root
|
||||
|
@ -113,35 +107,17 @@ Item {
|
|||
onReleased: {
|
||||
if (root.state === "closed" && root.y < dragArea.drag.maximumY) {
|
||||
root.state = "opened"
|
||||
// PageController.drawerOpen()
|
||||
return
|
||||
}
|
||||
|
||||
if (root.state === "opened" && root.y > dragArea.drag.minimumY) {
|
||||
root.state = "closed"
|
||||
// PageController.drawerClose()
|
||||
return
|
||||
}
|
||||
|
||||
if (root.state === "collapsed" && root.y < dragArea.drag.maximumY) {
|
||||
root.state = "expanded"
|
||||
return
|
||||
}
|
||||
if (root.state === "expanded" && root.y > dragArea.drag.minimumY) {
|
||||
root.state = "collapsed"
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (root.state === "expanded") {
|
||||
// PageController.drawerOpen()
|
||||
root.state = "collapsed"
|
||||
return
|
||||
}
|
||||
|
||||
if (root.state === "opened") {
|
||||
// PageController.drawerClose()
|
||||
root.state = "closed"
|
||||
return
|
||||
}
|
||||
|
@ -152,7 +128,7 @@ Item {
|
|||
}
|
||||
|
||||
onStateChanged: {
|
||||
if (root.state === "closed" || root.state === "collapsed") {
|
||||
if (root.state === "closed") {
|
||||
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
||||
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
||||
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
||||
|
@ -166,7 +142,7 @@ Item {
|
|||
|
||||
return
|
||||
}
|
||||
if (root.state === "expanded" || root.state === "opened") {
|
||||
if (root.state === "opened") {
|
||||
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
|
||||
PageController.updateNavigationBarColor(0xFF1C1D21)
|
||||
}
|
||||
|
@ -181,21 +157,6 @@ Item {
|
|||
|
||||
/** Two states of buttonContent, great place to add any future animations for the drawer */
|
||||
states: [
|
||||
State {
|
||||
name: "collapsed"
|
||||
PropertyChanges {
|
||||
target: root
|
||||
y: root.height - collapsedHeight
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "expanded"
|
||||
PropertyChanges {
|
||||
target: root
|
||||
y: dragArea.drag.minimumY
|
||||
}
|
||||
},
|
||||
|
||||
State {
|
||||
name: "closed"
|
||||
PropertyChanges {
|
||||
|
@ -214,25 +175,6 @@ Item {
|
|||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "collapsed"
|
||||
to: "expanded"
|
||||
PropertyAnimation {
|
||||
target: root
|
||||
properties: "y"
|
||||
duration: 200
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "expanded"
|
||||
to: "collapsed"
|
||||
PropertyAnimation {
|
||||
target: root
|
||||
properties: "y"
|
||||
duration: 200
|
||||
}
|
||||
},
|
||||
|
||||
Transition {
|
||||
from: "opened"
|
||||
to: "closed"
|
||||
|
|
|
@ -42,6 +42,8 @@ Item {
|
|||
|
||||
property Item drawerParent: root
|
||||
|
||||
property Drawer2Type menu: menu
|
||||
|
||||
implicitWidth: rootButtonContent.implicitWidth
|
||||
implicitHeight: rootButtonContent.implicitHeight
|
||||
|
||||
|
@ -157,13 +159,12 @@ Item {
|
|||
onClicked: {
|
||||
if (rootButtonClickedFunction && typeof rootButtonClickedFunction === "function") {
|
||||
rootButtonClickedFunction()
|
||||
} else {
|
||||
menu.open()
|
||||
}
|
||||
|
||||
menu.open()
|
||||
}
|
||||
}
|
||||
|
||||
//DrawerType {
|
||||
Drawer2Type {
|
||||
id: menu
|
||||
|
||||
|
@ -186,7 +187,7 @@ Item {
|
|||
BackButtonType {
|
||||
backButtonImage: root.headerBackButtonImage
|
||||
backButtonFunction: function() {
|
||||
root.menuVisible = false
|
||||
menu.state = "closed"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue