From f13f11d255913632df6d7b488afac8117d069ee1 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sat, 21 Sep 2019 10:45:22 +0200 Subject: [PATCH] Fix jittering during download by padding the numbers --- src/views/Settings.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/views/Settings.vue b/src/views/Settings.vue index e5800cb..828c764 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -176,9 +176,11 @@ export default class SettingsView extends Vue { current = `${(this.downloadProgress.progress / 2) | 0}`; total = `${(this.downloadProgress.total / 2) | 0}`; } else { - current = `${Math.round(this.downloadProgress.progress / 10485.76) / - 100}`; - total = `${Math.round(this.downloadProgress.total / 10485.76) / 100} MB`; + const currentNum = + Math.round(this.downloadProgress.progress / 10485.76) / 100; + current = currentNum.toString().padEnd(currentNum < 10 ? 4 : 5, "0"); + const totalNum = Math.round(this.downloadProgress.total / 10485.76) / 100; + total = totalNum.toString().padEnd(totalNum < 10 ? 4 : 5, "0") + " MB"; } const percent = Math.round( (this.downloadProgress.progress / this.downloadProgress.total) * 100