From 7a4e8b6352d06242d3c8006256f395c59f8d342a Mon Sep 17 00:00:00 2001 From: mehekj Date: Thu, 5 May 2022 13:32:34 -0400 Subject: drag video controls in full screen --- src/client/views/nodes/VideoBox.scss | 7 ++++-- src/client/views/nodes/VideoBox.tsx | 41 ++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/VideoBox.scss b/src/client/views/nodes/VideoBox.scss index 08d0bb035..1fb5cef98 100644 --- a/src/client/views/nodes/VideoBox.scss +++ b/src/client/views/nodes/VideoBox.scss @@ -161,9 +161,12 @@ align-items: flex-end; .videoBox-ui { - opacity: 0; - bottom: 50px; + // opacity: 0; + left: 50%; + top: 90%; + transform: translate(-50%, -50%); width: 80%; + transition: none; } .videoBox-ui:hover { diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 0344295bb..a4b7ffb9b 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -23,6 +23,7 @@ import { ContextMenu } from "../ContextMenu"; import { ContextMenuProps } from "../ContextMenuItem"; import { ViewBoxAnnotatableComponent, ViewBoxAnnotatableProps } from "../DocComponent"; import { DocumentDecorations } from "../DocumentDecorations"; +import { LinkPopup } from "../linking/LinkPopup"; import { MarqueeAnnotator } from "../MarqueeAnnotator"; import { AnchorMenu } from "../pdf/AnchorMenu"; import { StyleProp } from "../StyleProvider"; @@ -97,6 +98,8 @@ export class VideoBox extends ViewBoxAnnotatableComponent { + e.preventDefault(); + e.stopPropagation(); + const eleStyle = getComputedStyle(e.target as Element); + this._controlsTransform = { X: parseInt(eleStyle.left), Y: parseInt(eleStyle.top) }; + + setupMoveUpEvents(e.target, + e, + action((e, down, delta) => { + if (this._controlsTransform) { + this._controlsTransform.X = Math.max(0, Math.min(delta[0] + this._controlsTransform.X, window.innerWidth)); + this._controlsTransform.Y = Math.max(0, Math.min(delta[1] + this._controlsTransform.Y, window.innerHeight)); + } + return false; + }), + emptyFunction, + emptyFunction) + } + + // creates and links snapshot photo of current video frame @action public Snapshot = (downX?: number, downY?: number, cb?: (filename: string, x: number | undefined, y: number | undefined) => void) => { const width = NumCast(this.layoutDoc._width); @@ -383,7 +406,7 @@ export class VideoBox extends ViewBoxAnnotatableComponentLoading :
this._fullScreen && e.stopPropagation()}> - {this._fullScreen &&
+ {this._fullScreen &&
{this.UIButtons}
}
} @@ -760,7 +797,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent { e.stopPropagation(); this.toggleMute(); }}> + onPointerDown={this.onAudioDown}>