cava + nix

This commit is contained in:
Zacharias-Brohn
2026-02-26 16:27:05 +01:00
parent 09a93d9420
commit afb736102d
11 changed files with 311 additions and 237 deletions
+24 -4
View File
@@ -4,6 +4,7 @@ import qs.Config
Item {
id: root
property bool animate: false
property color color: DynamicColors.palette.m3onSurface
property int fadeStrengthAnimMs: 180
property real fadeStrengthIdle: 0.0
@@ -27,6 +28,19 @@ Item {
return Math.max(1, Math.round(Math.abs(px) / root.pixelsPerSecond * 1000));
}
function resetMarquee() {
// stop + reset all state immediately
marqueeAnim.stop();
strip.x = 0;
root.sliding = false;
root.leftFadeEnabled = false;
// restart after bindings/layout settle
if (root.marqueeEnabled && root.overflowing && root.visible) {
marqueeAnim.restart();
}
}
clip: true
implicitHeight: elideText.implicitHeight
@@ -39,10 +53,10 @@ Item {
}
}
onTextChanged: strip.x = 0
onTextChanged: resetMarquee()
onVisibleChanged: if (!visible)
strip.x = 0
onWidthChanged: strip.x = 0
resetMarquee()
onWidthChanged: resetMarquee()
TextMetrics {
id: metrics
@@ -55,8 +69,10 @@ Item {
id: elideText
anchors.verticalCenter: parent.verticalCenter
animate: root.animate
animateProp: "scale,opacity"
color: root.color
elide: Text.ElideRight
elide: Text.ElideNone
visible: !root.overflowing
width: root.width
}
@@ -84,6 +100,8 @@ Item {
CustomText {
id: t1
animate: root.animate
animateProp: "opacity"
color: root.color
text: elideText.text
}
@@ -91,6 +109,8 @@ Item {
CustomText {
id: t2
animate: root.animate
animateProp: "opacity"
color: root.color
text: t1.text
x: t1.width + root.gap