Calendar Panel

This commit is contained in:
quadbyte 2025-08-20 08:52:08 -04:00
parent 57fee68793
commit ece8e210cc
3 changed files with 114 additions and 212 deletions

View file

@ -24,7 +24,7 @@ Rectangle {
} }
onEntered: { onEntered: {
if (!calendarPanel.isLoaded) { if (!calendarPanel.active) {
tooltip.show() tooltip.show()
} }
} }
@ -33,7 +33,7 @@ Rectangle {
} }
onClicked: { onClicked: {
tooltip.hide() tooltip.hide()
calendarPanel.isLoaded = !calendarPanel.isLoaded calendarPanel.toggle(screen)
} }
} }
} }

View file

@ -7,107 +7,15 @@ import qs.Commons
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
NLoader { NPanel {
id: root id: root
content: Component { rWidth: 340 * scaling
NPanel { rHeight: 320 * scaling
id: calendarPanel rAnchorRight: true
// Override hide function to animate first
function hide() {
// Start hide animation
calendarRect.scaleValue = 0.8
calendarRect.opacityValue = 0.0
// Hide after animation completes
hideTimer.start()
}
// Connect to NPanel's dismissed signal to handle external close events
Connections {
target: calendarPanel
function onDismissed() {
// Start hide animation
calendarRect.scaleValue = 0.8
calendarRect.opacityValue = 0.0
// Hide after animation completes
hideTimer.start()
}
}
// Also handle visibility changes from external sources
onVisibleChanged: {
if (!visible && calendarRect.opacityValue > 0) {
// Start hide animation
calendarRect.scaleValue = 0.8
calendarRect.opacityValue = 0.0
// Hide after animation completes
hideTimer.start()
}
}
// Timer to hide panel after animation
Timer {
id: hideTimer
interval: Style.animationSlow
repeat: false
onTriggered: {
calendarPanel.visible = false
calendarPanel.dismissed()
}
}
Rectangle {
id: calendarRect
color: Color.mSurface
radius: Style.radiusM * scaling
border.color: Color.mOutline
border.width: Math.max(1, Style.borderM * scaling)
width: 340 * scaling
height: 320 * scaling // Reduced height to eliminate bottom space
anchors.top: parent.top
anchors.right: parent.right
anchors.topMargin: Style.marginXS * scaling
anchors.rightMargin: Style.marginXS * scaling
// Animation properties
property real scaleValue: 0.8
property real opacityValue: 0.0
scale: scaleValue
opacity: opacityValue
// Animate in when component is completed
Component.onCompleted: {
scaleValue = 1.0
opacityValue = 1.0
}
// Prevent closing when clicking in the panel bg
MouseArea {
anchors.fill: parent
}
// Animation behaviors
Behavior on scale {
NumberAnimation {
duration: Style.animationSlow
easing.type: Easing.OutExpo
}
}
Behavior on opacity {
NumberAnimation {
duration: Style.animationNormal
easing.type: Easing.OutQuad
}
}
// Main Column // Main Column
ColumnLayout { panelContent: ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: Style.marginM * scaling anchors.margins: Style.marginM * scaling
spacing: Style.marginXS * scaling spacing: Style.marginXS * scaling
@ -230,7 +138,4 @@ NLoader {
} }
} }
} }
}
}
}
} }

View file

@ -31,8 +31,6 @@ Loader {
signal opened signal opened
signal closed signal closed
// ----------------------------------------- // -----------------------------------------
function toggle(aScreen) { function toggle(aScreen) {
if (!active || isClosing) { if (!active || isClosing) {
@ -97,7 +95,6 @@ Loader {
Color.mShadow, Color.mShadow,
"BB") : Color.transparent "BB") : Color.transparent
WlrLayershell.exclusionMode: ExclusionMode.Ignore WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "noctalia-panel" WlrLayershell.namespace: "noctalia-panel"