small fixes

This commit is contained in:
Klemek
2025-02-21 22:42:10 +01:00
parent 38864aeac5
commit 360145d1bf
2 changed files with 9 additions and 7 deletions
+6 -4
View File
@@ -174,14 +174,16 @@ let app = {
this.sound.play();
},
timeText(minutes, padHours = 0) {
const prefix = minutes >= 0 ? '' : '-';
minutes = Math.abs(minutes);
if (minutes >= 60 || padHours > 0) {
return `${Math.floor(minutes / 60)
return `${prefix}${Math.floor(minutes / 60)
.toFixed(0)
.padStart(padHours, "0")}h${(minutes % 60)
.toFixed(0)
.padStart(2, "0")}`;
} else {
return `${(minutes % 60).toFixed(0).padStart(2, "0")}min`;
return `${prefix}${(minutes % 60).toFixed(0).padStart(2, "0")}min`;
}
},
spin() {
@@ -207,8 +209,8 @@ let app = {
}, 5000);
},
getSelected() {
if (this.svgData.length <= 1) {
return 0;
if (this.svgData.length === 1) {
return this.svgData[0].id;
}
const angle = 360 - (this.wheelPosition % 360);
for (let index = 0; index < this.svgData.length; index++) {