mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53:09 +00:00
quicksettings: Scale animation on delegate tap
This commit is contained in:
parent
37b0e709e8
commit
6830370b55
4 changed files with 26 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue