diff --git a/src/components/general/DateTimeSlider.vue b/src/components/general/DateTimeSlider.vue
index 4163d14e6..330f8aefe 100644
--- a/src/components/general/DateTimeSlider.vue
+++ b/src/components/general/DateTimeSlider.vue
@@ -50,12 +50,12 @@
-
+
+ mdi-play-speed
+
+ Playback speed
+
+
@@ -134,7 +134,7 @@ const currentSpeed = ref(defaultSpeed)
const availableSpeeds = [0.5, 1, 2, 4]
const isPlaying = ref(false)
-let playIntervalTimer: ReturnType | null = null
+let playTimeoutTimer: ReturnType | null = null
const doFollowNow = ref(props.doFollowNow)
let followNowIntervalTimer: ReturnType | null = null
@@ -286,17 +286,14 @@ function togglePlay(): void {
function startPlay(): void {
isPlaying.value = true
stopFollowNow()
- playIntervalTimer = setInterval(
- play,
- props.playInterval * (1 / currentSpeed.value),
- )
+ play()
}
function stopPlay(): void {
isPlaying.value = false
- if (playIntervalTimer) {
- clearInterval(playIntervalTimer)
- playIntervalTimer = null
+ if (playTimeoutTimer) {
+ clearTimeout(playTimeoutTimer)
+ playTimeoutTimer = null
}
}
@@ -305,6 +302,12 @@ function play(): void {
dateIndex.value = 0
}
increment(playIncrement)
+ if (isPlaying.value) {
+ playTimeoutTimer = setTimeout(
+ play,
+ props.playInterval * (1 / currentSpeed.value),
+ )
+ }
}
function stepBackward(): void {
@@ -327,10 +330,6 @@ function increment(step: number): void {
function setSpeed(speed: number) {
currentSpeed.value = speed
- if (isPlaying.value) {
- stopPlay()
- startPlay()
- }
}
function formatSpeed(speed: number) {