mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03: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 disabledButtonColor: PlasmaCore.Theme.backgroundColor
|
||||||
readonly property color disabledButtonPressedColor: Qt.darker(disabledButtonColor, 1.1)
|
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() {
|
function delegateClick() {
|
||||||
if (root.toggle) {
|
if (root.toggle) {
|
||||||
root.toggle();
|
root.toggle();
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,13 @@ QuickSettingsDelegate {
|
||||||
padding: PlasmaCore.Units.smallSpacing * 2
|
padding: PlasmaCore.Units.smallSpacing * 2
|
||||||
iconItem: icon
|
iconItem: icon
|
||||||
|
|
||||||
|
// scale animation on press
|
||||||
|
zoomScale: mouseArea.pressed ? 0.9 : 1
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
radius: PlasmaCore.Units.smallSpacing
|
radius: PlasmaCore.Units.smallSpacing
|
||||||
|
border.width: 1
|
||||||
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
|
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
|
||||||
color: {
|
color: {
|
||||||
if (root.enabled) {
|
if (root.enabled) {
|
||||||
|
|
@ -38,6 +43,7 @@ QuickSettingsDelegate {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
onClicked: root.delegateClick()
|
onClicked: root.delegateClick()
|
||||||
onPressAndHold: root.delegatePressAndHold()
|
onPressAndHold: root.delegatePressAndHold()
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ QuickSettingsDelegate {
|
||||||
|
|
||||||
iconItem: icon
|
iconItem: icon
|
||||||
|
|
||||||
|
// scale animation on press
|
||||||
|
zoomScale: mouseArea.pressed ? 0.9 : 1
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
radius: PlasmaCore.Units.smallSpacing
|
radius: PlasmaCore.Units.smallSpacing
|
||||||
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
|
border.color: root.enabled ? root.enabledButtonBorderColor : root.disabledButtonBorderColor
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ Item {
|
||||||
DragHandler {
|
DragHandler {
|
||||||
id: dragHandler
|
id: dragHandler
|
||||||
target: parent
|
target: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
yAxis.enabled: true
|
yAxis.enabled: true
|
||||||
xAxis.enabled: false
|
xAxis.enabled: false
|
||||||
|
|
@ -233,7 +234,6 @@ Item {
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
id: tapHandler
|
id: tapHandler
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onTapped: delegate.activateApp()
|
onTapped: delegate.activateApp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue