diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/GlobalKeyHandler.ts | 4 | ||||
-rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts index 1c5277de0..342cdcd95 100644 --- a/src/client/views/GlobalKeyHandler.ts +++ b/src/client/views/GlobalKeyHandler.ts @@ -28,6 +28,7 @@ import { SearchBox } from "./search/SearchBox"; import { random } from "lodash"; import { DocumentView } from "./nodes/DocumentView"; import { AudioBox } from "./nodes/AudioBox"; +import { VideoBox } from "./nodes/VideoBox"; const modifiers = ["control", "meta", "shift", "alt"]; type KeyHandler = (keycode: string, e: KeyboardEvent) => KeyControlInfo | Promise<KeyControlInfo>; @@ -122,6 +123,9 @@ export class KeyManager { DragManager.AbortDrag(); } else if (CollectionDockingView.Instance.HasFullScreen) { CollectionDockingView.Instance.CloseFullScreen(); + } else if (VideoBox.SelectingRegion) { + VideoBox.SelectingRegion = undefined; + doDeselect = false; } else if (AudioBox.SelectingRegion) { AudioBox.SelectingRegion = undefined; doDeselect = false; diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index fe76af55e..4de25a8b3 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -509,6 +509,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD // ref for timeline timelineRef = (timeline: HTMLDivElement) => { this._timeline = timeline; } + _doubleTime: NodeJS.Timeout | undefined; // starting the drag event creating a range marker @action onPointerDownTimeline = (e: React.PointerEvent): void => { @@ -516,16 +517,23 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD if (rect && e.target !== this._audioRef.current && this.active()) { const wasPlaying = this._playing; if (this._playing) this.Pause(); + !wasPlaying && !this._doubleTime && (this._doubleTime = setTimeout(() => { + this._doubleTime = undefined; + this.player!.currentTime = this.layoutDoc._currentTimecode = (e.clientX - rect.x) / rect.width * this.videoDuration; + }, 300)); this._markerStart = this._markerEnd = this.toTimeline(e.clientX - rect.x, rect.width); VideoBox.SelectingRegion = this; setupMoveUpEvents(this, e, action(e => { this._markerEnd = this.toTimeline(e.clientX - rect.x, rect.width); + if (this._doubleTime) { + clearTimeout(this._doubleTime); + this._doubleTime = undefined; + } return false; }), action((e, movement) => { - this._markerEnd = this.toTimeline(e.clientX - rect.x, rect.width); if (this._markerEnd < this._markerStart) { const tmp = this._markerStart; this._markerStart = this._markerEnd; @@ -535,9 +543,12 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD VideoBox.SelectingRegion = undefined; }), (e, doubleTap) => { + if (this._doubleTime && doubleTap) { + clearTimeout(this._doubleTime); + this._doubleTime = undefined; + } this.props.select(false); e.shiftKey && this.createMarker(this.player!.currentTime); - !wasPlaying && (this.player!.currentTime = this.layoutDoc._currentTimecode = (e.clientX - rect.x) / rect.width * this.videoDuration); !wasPlaying && doubleTap && this.Play(); } , this.props.isSelected(true) || this._isChildActive); |