NPanel: Sped up opening animation, removed close animation. No more lags and feel snappier

This commit is contained in:
ItsLemmy
2025-10-03 22:36:21 -04:00
parent 3302bfa08b
commit b85576653a
3 changed files with 5 additions and 41 deletions
@@ -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
-10
View File
@@ -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
+4 -30
View File
@@ -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
}
}