feat: change rate to .1 steps and fix floating (close #40)

This commit is contained in:
Michel Roux 2024-01-21 11:33:32 +01:00
parent 9f9fdf4cf0
commit ff23be4f91

View File

@ -8,11 +8,11 @@
</template> </template>
<template #extra> <template #extra>
<div class="extra"> <div class="extra">
<Minus class="pointer" :size="20" @click="changeRate(-.5)" /> <Minus class="pointer" :size="20" @click="changeRate(-.1)" />
<NcCounterBubble class="counter"> <NcCounterBubble class="counter">
x{{ player.rate }} x{{ player.rate }}
</NcCounterBubble> </NcCounterBubble>
<Plus class="pointer" :size="20" @click="changeRate(.5)" /> <Plus class="pointer" :size="20" @click="changeRate(.1)" />
</div> </div>
</template> </template>
</NcAppNavigationItem> </NcAppNavigationItem>
@ -92,9 +92,8 @@ export default {
methods: { methods: {
generateUrl, generateUrl,
changeRate(diff) { changeRate(diff) {
if (this.player.rate + diff > 0) { const newRate = (this.player.rate + diff).toPrecision(2)
this.$store.dispatch('player/rate', this.player.rate + diff) this.$store.dispatch('player/rate', newRate > 0 ? newRate : this.player.rate)
}
}, },
async importOpml(event) { async importOpml(event) {
try { try {