bigger hit area for the up arrow

This commit is contained in:
Marco Martin 2020-08-20 17:15:56 +02:00
parent 349de2f252
commit bb3225d4b5

View file

@ -155,7 +155,7 @@ Item {
color: "black" color: "black"
opacity: 0.4 * Math.min(1, mainFlickable.contentY / (units.gridUnit * 10)) opacity: 0.4 * Math.min(1, mainFlickable.contentY / (units.gridUnit * 10))
height: root.height + radius * 2 height: root.height + radius * 2
y: Math.max(-radius, -mainFlickable.contentY + arrowUpIcon.y - units.smallSpacing) y: Math.max(-radius, -mainFlickable.contentY + arrowUpIcon.y)
} }
Flickable { Flickable {
@ -253,18 +253,32 @@ Item {
imagePath: "widgets/arrows" imagePath: "widgets/arrows"
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
} }
Item { MouseArea {
id: arrowUpIcon id: arrowUpIcon
z: 9 z: 9
anchors { anchors {
horizontalCenter: parent.horizontalCenter left: parent.left
right: parent.right
bottom: parent.bottom bottom: parent.bottom
margins: -units.smallSpacing
} }
property real factor: Math.max(0, Math.min(1, mainFlickable.contentY / (mainFlickable.height/2)))
height: units.iconSizes.medium
onClicked: {
if (mainFlickable.contentY >= mainFlickable.height/2) {
scrollAnim.to = 0;
} else {
scrollAnim.to = mainFlickable.height/2
}
scrollAnim.restart();
}
Item {
anchors.centerIn: parent
width: units.iconSizes.medium width: units.iconSizes.medium
height: width height: width
property real factor: Math.max(0, Math.min(1, mainFlickable.contentY / (mainFlickable.height/2)))
Rectangle { Rectangle {
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -274,7 +288,7 @@ Item {
} }
color: theme.backgroundColor color: theme.backgroundColor
transformOrigin: Item.Right transformOrigin: Item.Right
rotation: -45 + 90 * parent.factor rotation: -45 + 90 * arrowUpIcon.factor
antialiasing: true antialiasing: true
height: 1 height: 1
} }
@ -287,23 +301,10 @@ Item {
} }
color: theme.backgroundColor color: theme.backgroundColor
transformOrigin: Item.Left transformOrigin: Item.Left
rotation: 45 - 90 * parent.factor rotation: 45 - 90 * arrowUpIcon.factor
antialiasing: true antialiasing: true
height: 1 height: 1
} }
MouseArea {
anchors {
fill: parent
margins: -units.smallSpacing
}
onClicked: {
if (mainFlickable.contentY >= mainFlickable.height/2) {
scrollAnim.to = 0;
} else {
scrollAnim.to = mainFlickable.height/2
}
scrollAnim.restart();
}
} }
} }