fix: performance network usage jumping around

This commit is contained in:
2 * r + 2 * t 2026-03-13 02:14:52 +11:00
parent c1795d187a
commit d97ba8a9c0

View file

@ -681,7 +681,7 @@ Item {
SparklineItem { SparklineItem {
id: sparkline id: sparkline
property real targetMax: Math.max(NetworkUsage.downloadBuffer.maximum, NetworkUsage.uploadBuffer.maximum, 1024) property real targetMax: 1024
property real smoothMax: targetMax property real smoothMax: targetMax
anchors.fill: parent anchors.fill: parent
@ -694,19 +694,23 @@ Item {
maxValue: smoothMax maxValue: smoothMax
historyLength: NetworkUsage.historyLength historyLength: NetworkUsage.historyLength
Timer { Connections {
interval: Config.dashboard.resourceUpdateInterval target: NetworkUsage.downloadBuffer
running: networkCard.visible
repeat: true function onValuesChanged(): void {
onTriggered: sparkline.targetMax = Math.max(NetworkUsage.downloadBuffer.maximum, NetworkUsage.uploadBuffer.maximum, 1024) sparkline.targetMax = Math.max(NetworkUsage.downloadBuffer.maximum, NetworkUsage.uploadBuffer.maximum, 1024);
slideAnim.restart();
}
} }
NumberAnimation on slideProgress { NumberAnimation {
id: slideAnim
target: sparkline
property: "slideProgress"
from: 0 from: 0
to: 1 to: 1
duration: Config.dashboard.resourceUpdateInterval duration: Config.dashboard.resourceUpdateInterval
loops: Animation.Infinite
running: networkCard.visible
} }
Behavior on smoothMax { Behavior on smoothMax {