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,56 +253,57 @@ 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
} }
width: units.iconSizes.medium
height: width
property real factor: Math.max(0, Math.min(1, mainFlickable.contentY / (mainFlickable.height/2))) property real factor: Math.max(0, Math.min(1, mainFlickable.contentY / (mainFlickable.height/2)))
Rectangle {
anchors { height: units.iconSizes.medium
verticalCenter: parent.verticalCenter onClicked: {
right: parent.horizontalCenter if (mainFlickable.contentY >= mainFlickable.height/2) {
left: parent.left scrollAnim.to = 0;
verticalCenterOffset: -arrowUpIcon.height/4 + (arrowUpIcon.height/4) * arrowUpIcon.factor } else {
scrollAnim.to = mainFlickable.height/2
} }
color: theme.backgroundColor scrollAnim.restart();
transformOrigin: Item.Right
rotation: -45 + 90 * parent.factor
antialiasing: true
height: 1
} }
Rectangle { Item {
anchors { anchors.centerIn: parent
verticalCenter: parent.verticalCenter
left: parent.horizontalCenter width: units.iconSizes.medium
right: parent.right height: width
verticalCenterOffset: -arrowUpIcon.height/4 + (arrowUpIcon.height/4) * arrowUpIcon.factor
} Rectangle {
color: theme.backgroundColor anchors {
transformOrigin: Item.Left verticalCenter: parent.verticalCenter
rotation: 45 - 90 * parent.factor right: parent.horizontalCenter
antialiasing: true left: parent.left
height: 1 verticalCenterOffset: -arrowUpIcon.height/4 + (arrowUpIcon.height/4) * arrowUpIcon.factor
}
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(); color: theme.backgroundColor
transformOrigin: Item.Right
rotation: -45 + 90 * arrowUpIcon.factor
antialiasing: true
height: 1
}
Rectangle {
anchors {
verticalCenter: parent.verticalCenter
left: parent.horizontalCenter
right: parent.right
verticalCenterOffset: -arrowUpIcon.height/4 + (arrowUpIcon.height/4) * arrowUpIcon.factor
}
color: theme.backgroundColor
transformOrigin: Item.Left
rotation: 45 - 90 * arrowUpIcon.factor
antialiasing: true
height: 1
} }
} }
} }