fixed the cursorShape, and some minor issues

This commit is contained in:
ronoaer
2023-10-17 22:00:19 +08:00
parent 03171e4743
commit a83cd29f72
+27 -20
View File
@@ -28,15 +28,13 @@ Item {
property int contentHeight: 0 property int contentHeight: 0
property Item contentParent: contentArea property Item contentParent: contentArea
y: parent.height - root.height
state: "closed" state: "closed"
Rectangle { Rectangle {
id: draw2Background id: draw2Background
anchors { left: root.left; right: root.right; top: root.top } anchors.fill: parent
height: root.parent.height height: parent.height
width: parent.width width: parent.width
radius: 16 radius: 16
color: "#90000000" color: "#90000000"
@@ -45,15 +43,14 @@ Item {
visible: true visible: true
MouseArea { MouseArea {
id: fullArea id: fullMouseArea
anchors.fill: parent anchors.fill: parent
enabled: (root.state === "opened") enabled: (root.state === "opened")
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
if (root.state === "opened") { if (root.state === "opened") {
draw2Background.color = "transparent" close()
root.state = "closed"
return return
} }
} }
@@ -106,15 +103,17 @@ Item {
/** 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" && placeAreaHolder.y < dragArea.drag.maximumY) { if (root.state === "closed" && placeAreaHolder.y < root.height * 0.9) {
root.state = "opened" root.state = "opened"
return return
} }
if (root.state === "opened" && placeAreaHolder.y > dragArea.drag.minimumY) { if (root.state === "opened" && placeAreaHolder.y > (root.height - root.height * 0.9)) {
close() close()
return return
} }
placeAreaHolder.y = 0
} }
onClicked: { onClicked: {
@@ -161,15 +160,15 @@ Item {
State { State {
name: "closed" name: "closed"
PropertyChanges { PropertyChanges {
target: root target: placeAreaHolder
y: parent.height y: parent.height
} }
}, },
State { State {
name: "opend" name: "opened"
PropertyChanges { PropertyChanges {
target: root target: placeAreaHolder
y: dragArea.drag.minimumY y: dragArea.drag.minimumY
} }
} }
@@ -180,7 +179,7 @@ Item {
from: "opened" from: "opened"
to: "closed" to: "closed"
PropertyAnimation { PropertyAnimation {
target: root target: placeAreaHolder
properties: "y" properties: "y"
duration: 200 duration: 200
} }
@@ -190,7 +189,7 @@ Item {
from: "closed" from: "closed"
to: "opened" to: "opened"
PropertyAnimation { PropertyAnimation {
target: root target: placeAreaHolder
properties: "y" properties: "y"
duration: 200 duration: 200
} }
@@ -199,7 +198,7 @@ Item {
NumberAnimation { NumberAnimation {
id: animationVisible id: animationVisible
target: root target: placeAreaHolder
property: "y" property: "y"
from: parent.height from: parent.height
to: 0 to: 0
@@ -212,21 +211,29 @@ Item {
} }
draw2Background.color = "#90000000" draw2Background.color = "#90000000"
fullMouseArea.visible = true
dragArea.visible = true
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
placeAreaHolder.height = parent.height - contentHeight
placeAreaHolder.y = parent.height - root.height
dragArea.drag.maximumY = parent.height contentArea.height = contentHeight
dragArea.drag.minimumY = parent.height - root.height
placeAreaHolder.height = root.height - contentHeight
placeAreaHolder.y = root.height - root.height
dragArea.drag.maximumY = root.height
dragArea.drag.minimumY = 0
animationVisible.running = true animationVisible.running = true
} }
function close() { function close() {
fullMouseArea.visible = false
dragArea.visible = false
draw2Background.color = "transparent" draw2Background.color = "transparent"
root.state = "closed" root.state = "closed"
} }