From 58ee7315c4ce7068456dffcdfc02bd57b4c7a37f Mon Sep 17 00:00:00 2001 From: Lionel Han <47760119+IGoByJoe@users.noreply.github.com> Date: Sat, 4 Jul 2020 21:31:16 -0700 Subject: modified playOnSelect and created repeat button --- src/client/views/nodes/AudioBox.scss | 14 ++++++++++++++ src/client/views/nodes/AudioBox.tsx | 31 ++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/AudioBox.scss b/src/client/views/nodes/AudioBox.scss index c959b79f5..2655f2377 100644 --- a/src/client/views/nodes/AudioBox.scss +++ b/src/client/views/nodes/AudioBox.scss @@ -45,6 +45,15 @@ width: 100%; height: 100%; position: relative; + + .recording { + width: 100%; + height: 100%; + position: relative; + display: flex; + padding-left: 2px; + background: lightgrey; + } } .audiobox-controls { @@ -53,6 +62,7 @@ position: relative; display: flex; padding-left: 2px; + background: lightgrey; .audiobox-player { margin-top: auto; @@ -72,6 +82,10 @@ padding: 2px; } + .audiobox-playhead:hover { + background-color: darkgrey; + } + .audiobox-dictation { align-items: center; display: inherit; diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx index d5288fff6..78d714ca9 100644 --- a/src/client/views/nodes/AudioBox.tsx +++ b/src/client/views/nodes/AudioBox.tsx @@ -53,6 +53,7 @@ export class AudioBox extends ViewBoxBaseComponent { runInAction(() => AudioBox._scrubTime = 0); runInAction(() => AudioBox._scrubTime = timeInMillisFrom1970); }; @@ -106,8 +107,12 @@ export class AudioBox extends ViewBoxBaseComponent { - this._ele!.pause(); - this.audioState = "paused"; + if (this._repeat) { + this.playFrom(0); + } else { + this._ele!.pause(); + this.audioState = "paused"; + } }); playFromTime = (absoluteTime: number) => { @@ -222,6 +227,12 @@ export class AudioBox extends ViewBoxBaseComponent; } + @action + onRepeat = (e: React.MouseEvent) => { + this._repeat = !this._repeat; + e.stopPropagation(); + } + render() { const interactive = this.active() ? "-interactive" : ""; return
@@ -231,13 +242,19 @@ export class AudioBox extends ViewBoxBaseComponent
: -
-
-
-
+
+
+
+
+
e.stopPropagation()} onPointerDown={e => { if (e.button === 0 && !e.ctrlKey) { -- cgit v1.2.3-70-g09d2