Bar SysMonitor: Implemented different sizing strategy to avoid unwanted shifting of items inside and outside the component.

This commit is contained in:
ItsLemmy
2025-09-27 13:38:56 -04:00
parent 423ea60939
commit a4b4caa2ce
3 changed files with 139 additions and 108 deletions
+9 -3
View File
@@ -325,14 +325,20 @@ Singleton {
// Helper function to format network speeds
function formatSpeed(bytesPerSecond) {
if (bytesPerSecond < 1024 * 1024) {
return (bytesPerSecond / 1024).toFixed(1) + "KB/s"
const kb = bytesPerSecond / 1024
if (kb < 10) {
return kb.toFixed(1) + "KB"
} else {
return Math.round(kb) + "KB"
}
} else if (bytesPerSecond < 1024 * 1024 * 1024) {
return (bytesPerSecond / (1024 * 1024)).toFixed(1) + "MB/s"
return (bytesPerSecond / (1024 * 1024)).toFixed(1) + "MB"
} else {
return (bytesPerSecond / (1024 * 1024 * 1024)).toFixed(1) + "GB/s"
return (bytesPerSecond / (1024 * 1024 * 1024)).toFixed(1) + "GB"
}
}
// -------------------------------------------------------
// Compact speed formatter for vertical bar display
function formatCompactSpeed(bytesPerSecond) {
if (!bytesPerSecond || bytesPerSecond <= 0)