From 6830370b55008599264e5fa8fd9e5706d9c9a15f Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Wed, 6 Apr 2022 21:55:06 -0400 Subject: [PATCH] quicksettings: Scale animation on delegate tap --- .../quicksettings/QuickSettingsDelegate.qml | 16 ++++++++++++++++ .../quicksettings/QuickSettingsFullDelegate.qml | 6 ++++++ .../QuickSettingsMinimizedDelegate.qml | 3 +++ components/mobileshell/qml/taskswitcher/Task.qml | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsDelegate.qml b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsDelegate.qml index 18c88434..75e228b3 100644 --- a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsDelegate.qml +++ b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsDelegate.qml @@ -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(); diff --git a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml index e237e63e..f67faca8 100644 --- a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml +++ b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsFullDelegate.qml @@ -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 diff --git a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml index 726cc92a..391c4148 100644 --- a/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml +++ b/components/mobileshell/qml/actiondrawer/quicksettings/QuickSettingsMinimizedDelegate.qml @@ -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 diff --git a/components/mobileshell/qml/taskswitcher/Task.qml b/components/mobileshell/qml/taskswitcher/Task.qml index cec0d3e4..60a74112 100644 --- a/components/mobileshell/qml/taskswitcher/Task.qml +++ b/components/mobileshell/qml/taskswitcher/Task.qml @@ -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() } }