From 118f709154991c837c697ab213ba0ccaadc4a755 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 6 May 2023 14:29:30 -0700 Subject: [PATCH] psvideo: allow rotation 270 (fix #394) Signed-off-by: Varun Patil --- src/components/viewer/PsVideo.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/viewer/PsVideo.ts b/src/components/viewer/PsVideo.ts index 3bd42991..cfe349b6 100644 --- a/src/components/viewer/PsVideo.ts +++ b/src/components/viewer/PsVideo.ts @@ -459,11 +459,16 @@ class VideoContentSetup { const hasRotation = rotation === 90 || rotation === 270; if (hasRotation) { - content.videoElement.style.width = content.element!.style.height; - content.videoElement.style.height = content.element!.style.width; + const vw = (content.videoElement.style.width = content.element!.style.height); + const vh = (content.videoElement.style.height = content.element!.style.width); - transform = `translateY(-${content.element!.style.width}) ${transform}`; - content.videoElement.style.transformOrigin = 'bottom left'; + if (rotation === 90) { + transform = `translateY(-${vh}) ${transform}`; + content.videoElement.style.transformOrigin = 'bottom left'; + } else if (rotation === 270) { + transform = `translateX(-${vw}) ${transform}`; + content.videoElement.style.transformOrigin = 'top right'; + } } content.videoElement.style.transform = transform;