update background color and drag-effect, moved dulicated code
This commit is contained in:
parent
7cc0f39d3c
commit
03171e4743
3 changed files with 17 additions and 14 deletions
|
|
@ -69,7 +69,7 @@ ListView {
|
||||||
isDefault = true
|
isDefault = true
|
||||||
|
|
||||||
menuContent.currentIndex = index
|
menuContent.currentIndex = index
|
||||||
containersDropDown.menu.state = "closed"
|
containersDropDown.menu.close()
|
||||||
|
|
||||||
|
|
||||||
if (needReconnected &&
|
if (needReconnected &&
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Item {
|
||||||
target: PageController
|
target: PageController
|
||||||
|
|
||||||
function onForceCloseDrawer() {
|
function onForceCloseDrawer() {
|
||||||
root.state = "closed"
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,8 +32,6 @@ Item {
|
||||||
|
|
||||||
state: "closed"
|
state: "closed"
|
||||||
|
|
||||||
Drag.active: dragArea.drag.active
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: draw2Background
|
id: draw2Background
|
||||||
|
|
||||||
|
|
@ -41,7 +39,7 @@ Item {
|
||||||
height: root.parent.height
|
height: root.parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
radius: 16
|
radius: 16
|
||||||
color: "transparent"
|
color: "#90000000"
|
||||||
border.color: "transparent"
|
border.color: "transparent"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
visible: true
|
visible: true
|
||||||
|
|
@ -54,6 +52,7 @@ Item {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.state === "opened") {
|
if (root.state === "opened") {
|
||||||
|
draw2Background.color = "transparent"
|
||||||
root.state = "closed"
|
root.state = "closed"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -61,14 +60,16 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: placeAreaHolder
|
id: placeAreaHolder
|
||||||
anchors.top: parent.top
|
|
||||||
height: parent.height - contentHeight
|
height: parent.height - contentHeight
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
visible: true
|
visible: true
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
|
Drag.active: dragArea.drag.active
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentArea
|
id: contentArea
|
||||||
|
|
||||||
|
|
@ -98,27 +99,27 @@ Item {
|
||||||
cursorShape: (root.state === "opened") ? Qt.PointingHandCursor : Qt.ArrowCursor
|
cursorShape: (root.state === "opened") ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
drag.target: root
|
drag.target: placeAreaHolder
|
||||||
drag.axis: Drag.YAxis
|
drag.axis: Drag.YAxis
|
||||||
drag.maximumY: root.height
|
drag.maximumY: root.height
|
||||||
drag.minimumY: root.height - root.height
|
drag.minimumY: root.height - root.height
|
||||||
|
|
||||||
/** If drag area is released at any point other than min or max y, transition to the other state */
|
/** If drag area is released at any point other than min or max y, transition to the other state */
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if (root.state === "closed" && root.y < dragArea.drag.maximumY) {
|
if (root.state === "closed" && placeAreaHolder.y < dragArea.drag.maximumY) {
|
||||||
root.state = "opened"
|
root.state = "opened"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.state === "opened" && root.y > dragArea.drag.minimumY) {
|
if (root.state === "opened" && placeAreaHolder.y > dragArea.drag.minimumY) {
|
||||||
root.state = "closed"
|
close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.state === "opened") {
|
if (root.state === "opened") {
|
||||||
root.state = "closed"
|
close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -209,22 +210,24 @@ Item {
|
||||||
if (root.visible && root.state !== "closed") {
|
if (root.visible && root.state !== "closed") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
draw2Background.color = "#90000000"
|
||||||
|
|
||||||
root.y = 0
|
root.y = 0
|
||||||
root.state = "opened"
|
root.state = "opened"
|
||||||
root.visible = true
|
root.visible = true
|
||||||
root.height = parent.height
|
root.height = parent.height
|
||||||
contentArea.height = contentHeight
|
contentArea.height = contentHeight
|
||||||
|
placeAreaHolder.height = parent.height - contentHeight
|
||||||
|
placeAreaHolder.y = parent.height - root.height
|
||||||
|
|
||||||
dragArea.drag.maximumY = parent.height
|
dragArea.drag.maximumY = parent.height
|
||||||
dragArea.drag.minimumY = parent.height - root.height
|
dragArea.drag.minimumY = parent.height - root.height
|
||||||
|
|
||||||
|
|
||||||
animationVisible.running = true
|
animationVisible.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
root.visible = false
|
draw2Background.color = "transparent"
|
||||||
root.state = "closed"
|
root.state = "closed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ Item {
|
||||||
BackButtonType {
|
BackButtonType {
|
||||||
backButtonImage: root.headerBackButtonImage
|
backButtonImage: root.headerBackButtonImage
|
||||||
backButtonFunction: function() {
|
backButtonFunction: function() {
|
||||||
menu.state = "closed"
|
menu.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue