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() {
if (MobileShellState.ShellDBusClient.isTaskSwitcherVisible) {
itemContainer.zoomOutImmediately();
} else {
} else if (!WindowPlugin.WindowMaximizedTracker.showingWindow) {
itemContainer.zoomIn();
}
}
@ -124,8 +124,7 @@ Item {
function onLockscreenUnlocked() {
// run zoom animation after login
itemContainer.opacity = 0;
itemContainer.zoomScale = 0.8;
itemContainer.zoomOutImmediately();
itemContainer.zoomIn();
}
}
@ -162,6 +161,8 @@ Item {
}
function zoomOutImmediately() {
scaleAnim.stop();
opacityAnim.stop();
zoomScale = zoomScaleOut;
opacity = 0;
}
@ -178,24 +179,15 @@ Item {
running: false
easing.type: Easing.OutExpo
}
function evaluateAnimChange() {
// only animate if homescreen is visible
if ((!WindowPlugin.WindowMaximizedTracker.showingWindow || WindowPlugin.WindowUtil.activeWindowIsShell) &&
!MobileShellState.ShellDBusClient.isTaskSwitcherVisible) {
if (!WindowPlugin.WindowMaximizedTracker.showingWindow && !MobileShellState.ShellDBusClient.isTaskSwitcherVisible) {
itemContainer.zoomIn();
} else {
itemContainer.zoomOut();
}
}
Connections {
target: WindowPlugin.WindowUtil
function onActiveWindowIsShellChanged() {
itemContainer.evaluateAnimChange();
}
}
Connections {
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.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.windowplugin as WindowPlugin
@ -46,12 +46,16 @@ PlasmaCore.ColorScope {
readonly property real intendedWindowThickness: navigationPanelHeight
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
onIntendedWindowLengthChanged: maximizeTimer.restart() // ensure it always takes up the full length of the screen
onIntendedWindowOffsetChanged: plasmoid.Window.window.offset = intendedWindowOffset
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
// - improves performance if the shell is run in a window, and can be resized
@ -76,7 +80,7 @@ PlasmaCore.ColorScope {
function setWindowProperties() {
// 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.offset = intendedWindowOffset;
plasmoid.Window.window.thickness = navigationPanelHeight;