From 0505df6d271c3989c652e08ddb254c72f8954ab8 Mon Sep 17 00:00:00 2001 From: hvangeffen Date: Thu, 18 Jan 2024 14:59:33 +0100 Subject: [PATCH 1/3] Add 2x 4x and 0.5x speed selection menu --- src/components/general/DateTimeSlider.vue | 42 ++++++++++++++++++- .../SpatialDisplayComponent.vue | 2 +- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/components/general/DateTimeSlider.vue b/src/components/general/DateTimeSlider.vue index e02844c39..f8efcfa3d 100644 --- a/src/components/general/DateTimeSlider.vue +++ b/src/components/general/DateTimeSlider.vue @@ -48,6 +48,27 @@
+ + + + + + + | null = null @@ -263,7 +288,10 @@ function togglePlay(): void { function startPlay(): void { isPlaying.value = true stopFollowNow() - playIntervalTimer = setInterval(play, props.playInterval) + playIntervalTimer = setInterval( + play, + props.playInterval * (1 / currentSpeed.value), + ) } function stopPlay(): void { @@ -298,6 +326,18 @@ function decrement(step: number): void { function increment(step: number): void { dateIndex.value = Math.min(dateIndex.value + step, maxIndex.value) } + +function setSpeed(speed: number) { + currentSpeed.value = speed + if (isPlaying.value) { + stopPlay() + startPlay() + } +} + +function formatSpeed(speed: number) { + return speed === defaultSpeed ? 'Normal' : `${speed}x` +}