diff --git a/components/controls/CircularProgress.qml b/components/controls/CircularProgress.qml index 7c2f1b2c..a501e12b 100644 --- a/components/controls/CircularProgress.qml +++ b/components/controls/CircularProgress.qml @@ -28,7 +28,7 @@ Item { readonly property real size: Math.min(width, height) readonly property real arcRadius: (size - padding - strokeWidth * (1 + waveAmplitude * 2)) / 2 - readonly property real clampedVal: Math.max(1 / 360, Math.min(1, value)) + property real clampedVal: Math.max(1 / 360, Math.min(1, isNaN(value) ? 0 : value)) // Not readonly for animations readonly property real gapAngle: ((spacing + strokeWidth) / (arcRadius || 1)) * (180 / Math.PI) readonly property real dotAngleRad: (startAngle + sweepAngle - gapAngle * (sweepAngle < 360 ? 0 : 1)) * Math.PI / 180 diff --git a/modules/dashboard/dash/Resources.qml b/modules/dashboard/dash/Resources.qml index 45bd949d..659de7b0 100644 --- a/modules/dashboard/dash/Resources.qml +++ b/modules/dashboard/dash/Resources.qml @@ -53,7 +53,7 @@ Item { implicitSize: height strokeWidth: Tokens.sizes.dashboard.resourceProgressThickness - Behavior on value { + Behavior on clampedVal { Anim {} } diff --git a/modules/dashboard/performance/HeroCard.qml b/modules/dashboard/performance/HeroCard.qml index a6482b27..9634516d 100644 --- a/modules/dashboard/performance/HeroCard.qml +++ b/modules/dashboard/performance/HeroCard.qml @@ -36,7 +36,7 @@ StyledRect { implicitSize: Math.max(icon.implicitWidth, icon.implicitHeight) + Tokens.padding.medium * 2 value: root.usage - Behavior on value { + Behavior on clampedVal { Anim {} } @@ -102,6 +102,7 @@ StyledRect { value: root.temperature / 100 implicitHeight: Tokens.padding.small fgColour: root.accent + indeterminate: isNaN(root.usage) || isNaN(root.temperature) } } @@ -139,7 +140,7 @@ StyledRect { StyledText { anchors.centerIn: parent - text: Math.round(root.usage * 100) + "%" + text: isNaN(root.usage) ? "...%" : Math.round(root.usage * 100) + "%" color: root.accent font: Tokens.font.headline.builders.small.width(50).build() }