diff --git a/Components/MarqueeText.qml b/Components/MarqueeText.qml index 3788844..925b409 100644 --- a/Components/MarqueeText.qml +++ b/Components/MarqueeText.qml @@ -4,6 +4,7 @@ import qs.Config Item { id: root + property alias anim: marqueeAnim property bool animate: false property color color: DynamicColors.palette.m3onSurface property int fadeStrengthAnimMs: 180 @@ -29,13 +30,11 @@ Item { } 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(); } @@ -120,20 +119,9 @@ Item { SequentialAnimation { id: marqueeAnim - loops: Animation.Infinite - running: root.marqueeEnabled && root.overflowing && root.visible + running: false - ScriptAction { - script: { - strip.x = 0; - root.sliding = false; - root.leftFadeEnabled = false; - } - } - - PauseAnimation { - duration: root.pauseMs - } + onFinished: pauseTimer.restart() ScriptAction { script: { @@ -175,6 +163,19 @@ Item { } } } + + Timer { + id: pauseTimer + + interval: root.pauseMs + repeat: false + running: true + + onTriggered: { + if (root.marqueeEnabled) + marqueeAnim.start(); + } + } } Rectangle { diff --git a/Modules/MediaWidget.qml b/Modules/MediaWidget.qml index 73b4056..8b47a07 100644 --- a/Modules/MediaWidget.qml +++ b/Modules/MediaWidget.qml @@ -65,9 +65,24 @@ Item { color: Players.active?.isPlaying ? DynamicColors.palette.m3primary : DynamicColors.palette.m3onSurface font.pointSize: Appearance.font.size.normal horizontalAlignment: Text.AlignHCenter + marqueeEnabled: false pauseMs: 4000 text: root.currentMedia width: root.textWidth + + CustomMouseArea { + anchors.fill: parent + hoverEnabled: true + + onContainsMouseChanged: { + if (!containsMouse) { + mediatext.marqueeEnabled = false; + } else { + mediatext.marqueeEnabled = true; + mediatext.anim.start(); + } + } + } } } }