Ron Au commited on
Commit
0ae2e26
1 Parent(s): 27a17c1

fix(ui): Trim handle animation to sync with audio

Browse files
Files changed (1) hide show
  1. source/ui/src/lib/Notes.svelte +4 -1
source/ui/src/lib/Notes.svelte CHANGED
@@ -90,7 +90,10 @@ const keyDown = (event: KeyboardEvent): void => {
90
  tabindex="0"
91
  >
92
  <audio bind:currentTime bind:duration bind:paused src={$audioBlob} />
93
- <div class="handle" style:transform="translate({imageWidth * (currentTime / duration)}px, -2%)" />
 
 
 
94
  {#if paused}
95
  <img
96
  class="play-button"
 
90
  tabindex="0"
91
  >
92
  <audio bind:currentTime bind:duration bind:paused src={$audioBlob} />
93
+ <div
94
+ class="handle"
95
+ style:transform="translate({Math.min(imageWidth * (currentTime / (duration - 0.9)), imageWidth)}px, -2%)"
96
+ />
97
  {#if paused}
98
  <img
99
  class="play-button"