homescreen: Fix zoom animation behaviour with windows

This commit is contained in:
Devin Lin 2023-03-26 11:22:14 -07:00
parent e16bdea17e
commit 33771b4afd
2 changed files with 14 additions and 18 deletions

View file

@ -107,7 +107,7 @@ Item {
function onIsTaskSwitcherVisibleChanged() { function onIsTaskSwitcherVisibleChanged() {
if (MobileShellState.ShellDBusClient.isTaskSwitcherVisible) { if (MobileShellState.ShellDBusClient.isTaskSwitcherVisible) {
itemContainer.zoomOutImmediately(); itemContainer.zoomOutImmediately();
} else { } else if (!WindowPlugin.WindowMaximizedTracker.showingWindow) {
itemContainer.zoomIn(); itemContainer.zoomIn();
} }
} }
@ -124,8 +124,7 @@ Item {
function onLockscreenUnlocked() { function onLockscreenUnlocked() {
// run zoom animation after login // run zoom animation after login
itemContainer.opacity = 0; itemContainer.zoomOutImmediately();
itemContainer.zoomScale = 0.8;
itemContainer.zoomIn(); itemContainer.zoomIn();
} }
} }
@ -162,6 +161,8 @@ Item {
} }
function zoomOutImmediately() { function zoomOutImmediately() {
scaleAnim.stop();
opacityAnim.stop();
zoomScale = zoomScaleOut; zoomScale = zoomScaleOut;
opacity = 0; opacity = 0;
} }
@ -181,22 +182,13 @@ Item {
function evaluateAnimChange() { function evaluateAnimChange() {
// only animate if homescreen is visible // only animate if homescreen is visible
if ((!WindowPlugin.WindowMaximizedTracker.showingWindow || WindowPlugin.WindowUtil.activeWindowIsShell) && if (!WindowPlugin.WindowMaximizedTracker.showingWindow && !MobileShellState.ShellDBusClient.isTaskSwitcherVisible) {
!MobileShellState.ShellDBusClient.isTaskSwitcherVisible) {
itemContainer.zoomIn(); itemContainer.zoomIn();
} else { } else {
itemContainer.zoomOut(); itemContainer.zoomOut();
} }
} }
Connections {
target: WindowPlugin.WindowUtil
function onActiveWindowIsShellChanged() {
itemContainer.evaluateAnimChange();
}
}
Connections { Connections {
target: WindowPlugin.WindowMaximizedTracker target: WindowPlugin.WindowMaximizedTracker

View file

@ -15,7 +15,7 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kquickcontrolsaddons 2.0 import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.mobileshell as MobileShell
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
@ -46,12 +46,16 @@ PlasmaCore.ColorScope {
readonly property real intendedWindowThickness: navigationPanelHeight readonly property real intendedWindowThickness: navigationPanelHeight
readonly property real intendedWindowLength: isInLandscapeNavPanelMode ? Screen.height : Screen.width readonly property real intendedWindowLength: isInLandscapeNavPanelMode ? Screen.height : Screen.width
readonly property real intendedWindowOffset: isInLandscapeNavPanelMode ? Components.Constants.topPanelHeight : 0; // offset for top panel readonly property real intendedWindowOffset: isInLandscapeNavPanelMode ? MobileShell.Constants.topPanelHeight : 0; // offset for top panel
readonly property int intendedWindowLocation: isInLandscapeNavPanelMode ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge readonly property int intendedWindowLocation: isInLandscapeNavPanelMode ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.BottomEdge
onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen
onIntendedWindowOffsetChanged: plasmoid.Window.window.offset = intendedWindowOffset
onIntendedWindowLocationChanged: locationChangeTimer.restart() onIntendedWindowLocationChanged: locationChangeTimer.restart()
onIntendedWindowOffsetChanged: {
if (plasmoid && plasmoid.Window.window) {
plasmoid.Window.window.offset = intendedWindowOffset;
}
}
// use a timer so we don't have to maximize for every single pixel // use a timer so we don't have to maximize for every single pixel
// - improves performance if the shell is run in a window, and can be resized // - improves performance if the shell is run in a window, and can be resized
@ -76,7 +80,7 @@ PlasmaCore.ColorScope {
function setWindowProperties() { function setWindowProperties() {
// plasmoid.Window.window is assumed to be plasma-workspace "PanelView" component // plasmoid.Window.window is assumed to be plasma-workspace "PanelView" component
if (plasmoid) { if (plasmoid && plasmoid.Window.window) {
plasmoid.Window.window.maximize(); // maximize first, then we can apply offsets (otherwise they are overridden) plasmoid.Window.window.maximize(); // maximize first, then we can apply offsets (otherwise they are overridden)
plasmoid.Window.window.offset = intendedWindowOffset; plasmoid.Window.window.offset = intendedWindowOffset;
plasmoid.Window.window.thickness = navigationPanelHeight; plasmoid.Window.window.thickness = navigationPanelHeight;