quicksettings: Scale animation on delegate tap

This commit is contained in:
Devin Lin 2022-04-06 21:55:06 -04:00
parent 37b0e709e8
commit 6830370b55
4 changed files with 26 additions and 1 deletions

View file

@ -40,6 +40,22 @@ Components.BaseItem {
readonly property color disabledButtonColor: PlasmaCore.Theme.backgroundColor
readonly property color disabledButtonPressedColor: Qt.darker(disabledButtonColor, 1.1)
// scale animation on press
property real zoomScale: 1
Behavior on zoomScale {
NumberAnimation {
duration: 200
easing.type: Easing.OutExpo
}
}
transform: Scale {
origin.x: root.width / 2;
origin.y: root.height / 2;
xScale: root.zoomScale
yScale: root.zoomScale
}
function delegateClick() {
if (root.toggle) {
root.toggle();

View file

@ -22,8 +22,13 @@ QuickSettingsDelegate {
padding: PlasmaCore.Units.smallSpacing * 2
iconItem: icon
// scale animation on press
zoomScale: mouseArea.pressed ? 0.9 : 1
background: Rectangle {
anchors.fill: parent
radius: PlasmaCore.Units.smallSpacing
border.width: 1
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
color: {
if (root.enabled) {
@ -38,6 +43,7 @@ QuickSettingsDelegate {
id: mouseArea
onClicked: root.delegateClick()
onPressAndHold: root.delegatePressAndHold()
cursorShape: Qt.PointingHandCursor
PlasmaCore.IconItem {
id: icon

View file

@ -20,6 +20,9 @@ QuickSettingsDelegate {
iconItem: icon
// scale animation on press
zoomScale: mouseArea.pressed ? 0.9 : 1
background: Rectangle {
radius: PlasmaCore.Units.smallSpacing
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor

View file

@ -75,6 +75,7 @@ Item {
DragHandler {
id: dragHandler
target: parent
cursorShape: Qt.PointingHandCursor
yAxis.enabled: true
xAxis.enabled: false
@ -233,7 +234,6 @@ Item {
TapHandler {
id: tapHandler
cursorShape: Qt.PointingHandCursor
onTapped: delegate.activateApp()
}
}