Fix some animations not following setting

This commit is contained in:
Devin Lin 2022-04-30 11:07:07 -04:00
parent a18313b447
commit ce06af0e8a
3 changed files with 11 additions and 8 deletions

View file

@ -24,7 +24,7 @@ QuickSettingsDelegate {
iconItem: icon
// scale animation on press
zoomScale: mouseArea.pressed ? 0.9 : 1
zoomScale: (MobileShell.MobileShellSettings.animationsEnabled && mouseArea.pressed) ? 0.9 : 1
background: Rectangle {
anchors.fill: parent

View file

@ -22,7 +22,7 @@ QuickSettingsDelegate {
iconItem: icon
// scale animation on press
zoomScale: mouseArea.pressed ? 0.9 : 1
zoomScale: (MobileShell.MobileShellSettings.animationsEnabled && mouseArea.pressed) ? 0.9 : 1
background: Rectangle {
radius: PlasmaCore.Units.smallSpacing

View file

@ -114,27 +114,30 @@ Item {
Component.onCompleted: zoomIn()
function zoomIn() {
// don't use check animationsEnabled here, so we ensure the scale and opacity is always 1 when disabled
scaleAnim.to = 1;
scaleAnim.restart();
opacityAnim.to = 1;
opacityAnim.restart();
}
function zoomOut() {
scaleAnim.to = 0.8;
scaleAnim.restart();
opacityAnim.to = 0;
opacityAnim.restart();
if (MobileShell.MobileShellSettings.animationsEnabled) {
scaleAnim.to = 0.8;
scaleAnim.restart();
opacityAnim.to = 0;
opacityAnim.restart();
}
}
NumberAnimation on opacity {
id: opacityAnim
duration: 300
duration: MobileShell.MobileShellSettings.animationsEnabled ? 300 : 0
running: false
}
NumberAnimation on zoomScale {
id: scaleAnim
duration: 600
duration: MobileShell.MobileShellSettings.animationsEnabled ? 600 : 0
running: false
easing.type: Easing.OutExpo
}