From b85576653a28d71df6c347fde64b079f88b0ce94 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Fri, 3 Oct 2025 22:36:21 -0400 Subject: [PATCH] NPanel: Sped up opening animation, removed close animation. No more lags and feel snappier --- .../Launcher/Plugins/ApplicationsPlugin.qml | 2 +- Services/PanelService.qml | 10 ------ Widgets/NPanel.qml | 34 +++---------------- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/Modules/Launcher/Plugins/ApplicationsPlugin.qml b/Modules/Launcher/Plugins/ApplicationsPlugin.qml index f6d7df93..936f1bd4 100644 --- a/Modules/Launcher/Plugins/ApplicationsPlugin.qml +++ b/Modules/Launcher/Plugins/ApplicationsPlugin.qml @@ -149,7 +149,7 @@ Item { "onActivate": function () { // Close the launcher/NPanel immediately without any animations. // Ensures we are not preventing the future focusing of the app - launcher.closeCompleted() + launcher.close() Logger.log("ApplicationsPlugin", `Launching: ${app.name}`) // Record usage and persist asynchronously diff --git a/Services/PanelService.qml b/Services/PanelService.qml index 5d33aeb7..29320c1d 100644 --- a/Services/PanelService.qml +++ b/Services/PanelService.qml @@ -13,9 +13,7 @@ Singleton { // Panels property var registeredPanels: ({}) property var openedPanel: null - property bool hasOpenedPanel: false signal willOpen - signal willClose // Currently opened popups, can have more than one. // ex: when opening an NIconPicker from a widget setting. @@ -45,19 +43,11 @@ Singleton { openedPanel.close() } openedPanel = panel - hasOpenedPanel = true // emit signal willOpen() } - function willClosePanel(panel) { - hasOpenedPanel = false - - // emit signal - willClose() - } - function closedPanel(panel) { if (openedPanel && openedPanel === panel) { openedPanel = null diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 355edf02..d56f7be1 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -43,8 +43,6 @@ Loader { property real opacityValue: originalOpacity property real dimmingOpacity: 0 - property alias isClosing: hideTimer.running - signal opened signal closed @@ -75,7 +73,7 @@ Loader { // ----------------------------------------- function toggle(buttonItem) { - if (!active || isClosing) { + if (!active) { open(buttonItem) } else { close() @@ -96,13 +94,6 @@ Loader { useButtonPosition = false } - // Special case if currently closing/animating - if (isClosing) { - hideTimer.stop() // in case we were closing - scaleValue = 1.0 - opacityValue = 1.0 - } - PanelService.willOpenPanel(root) backgroundClickEnabled = true @@ -115,12 +106,6 @@ Loader { dimmingOpacity = 0 scaleValue = originalScale opacityValue = originalOpacity - hideTimer.start() - PanelService.willClosePanel(root) - } - - // ----------------------------------------- - function closeCompleted() { root.closed() active = false useButtonPosition = false @@ -128,17 +113,6 @@ Loader { PanelService.closedPanel(root) } - // ----------------------------------------- - // Timer to disable the loader after the close animation is completed - Timer { - id: hideTimer - interval: Style.animationSlow - repeat: false - onTriggered: { - closeCompleted() - } - } - // ----------------------------------------- sourceComponent: Component { PanelWindow { @@ -193,7 +167,7 @@ Loader { Behavior on color { ColorAnimation { - duration: Style.animationSlow + duration: Style.animationNormal } } @@ -205,7 +179,7 @@ Loader { // Close any panel with Esc without requiring focus Shortcut { sequences: ["Escape"] - enabled: root.active && !root.isClosing + enabled: root.active onActivated: root.close() context: Qt.WindowShortcut } @@ -403,7 +377,7 @@ Loader { // Animation behaviors Behavior on scale { NumberAnimation { - duration: Style.animationSlow + duration: Style.animationNormal easing.type: Easing.OutExpo } }