marin showed me the way im okay help

This commit is contained in:
Amaru8 2022-05-18 22:01:02 +02:00
parent 9874d1c62d
commit a35d0d26f8
3 changed files with 10 additions and 19 deletions

View file

@ -29,7 +29,7 @@
data: function () {
return {
app: this.$root,
playbackRate: this.$root.cfg.audio.playbackRate / 100
playbackRate: this.$root.cfg.audio.playbackRate
}
},
watch: {
@ -40,31 +40,22 @@
methods: {
playbackRateWheel(event) {
if (app.checkScrollDirectionIsUp(event)) {
this.saveValue(this.$root.cfg.audio.playbackRate + 5);
this.saveValue(this.$root.cfg.audio.playbackRate + 0.05);
} else {
this.saveValue(this.$root.cfg.audio.playbackRate - 5);
this.saveValue(this.$root.cfg.audio.playbackRate - 0.05);
}
},
saveValue(newValue) {
newValue = Number(newValue);
if (this.isAllowedRate(newValue)) {
if (newValue > 2) {
newValue = String(newValue).length > 4 ? newValue.toFixed(2) : newValue;
this.$root.mk.playbackRate = newValue / 100;
this.$root.cfg.audio.playbackRate = newValue;
this.playbackRate = newValue / 100;
} else {
newValue = String(newValue).length > 6 ? newValue.toFixed(2) : newValue;
this.$root.mk.playbackRate = newValue;
this.$root.cfg.audio.playbackRate = newValue * 100;
this.playbackRate = newValue;
}
newValue = String(newValue).length > 6 ? newValue.toFixed(2) : newValue;
this.$root.mk.playbackRate = newValue;
this.$root.cfg.audio.playbackRate = newValue;
this.playbackRate = newValue;
}
},
isAllowedRate(input) {
if (input >= 25 && input <= 200) { return true }
if (input >= 0.25 && input <= 2) { return true }
return false;
return input >= 0.25 && input <= 2 ? true : false;
}
}
});