From 75ad47f61f3ef1bfbb9035fd300e1a96effd22f7 Mon Sep 17 00:00:00 2001 From: Sudharsan Selvaraj Date: Sun, 14 Apr 2024 19:12:42 +0530 Subject: [PATCH] Support landacape & portrait mode for manual device session --- src/modules | 2 +- web/src/components/streaming/AndroidStream.tsx | 4 ++-- web/src/components/streaming/ios-stream.tsx | 8 ++++---- web/src/libs/simple-interation-handler.ts | 8 ++++++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/modules b/src/modules index 2e64b91ff..cfece3df3 160000 --- a/src/modules +++ b/src/modules @@ -1 +1 @@ -Subproject commit 2e64b91ff707aa5893c8711fc4ce11b0838701b2 +Subproject commit cfece3df371eb9a045b49c5acbc6cdbc341942ce diff --git a/web/src/components/streaming/AndroidStream.tsx b/web/src/components/streaming/AndroidStream.tsx index c57629930..e6d3fd18c 100644 --- a/web/src/components/streaming/AndroidStream.tsx +++ b/web/src/components/streaming/AndroidStream.tsx @@ -68,7 +68,7 @@ function AndroidStream() { containerElement.current && videoElement.current ) { - videoElement.current.style.height = height + 'px'; + //videoElement.current.style.width = width + 'px'; interactionHandler = new SimpleInterationHandler( videoElement.current as any, canvasElement.current, @@ -156,7 +156,7 @@ function AndroidStream() { style={{ maxHeight: MAX_HEIGHT + 'px', maxWidth: MAX_WIDTH + 'px', - width: 'auto', + height: 'auto!important', position: 'absolute', }} src={imageSrc} diff --git a/web/src/components/streaming/ios-stream.tsx b/web/src/components/streaming/ios-stream.tsx index 1f092c1ca..4a1c960bc 100644 --- a/web/src/components/streaming/ios-stream.tsx +++ b/web/src/components/streaming/ios-stream.tsx @@ -9,8 +9,8 @@ import DeviceLoading from '../../assets/device-loading.gif'; import useWebSocket from 'react-use-websocket'; import { StreamActionNotifier } from './StreamActionNotifier.tsx'; -const MAX_HEIGHT = 720; -const MAX_WIDTH = 720; +const MAX_HEIGHT = 820; +const MAX_WIDTH = 820; function IOSStream() { const getParamsFromUrl = () => { @@ -67,7 +67,7 @@ function IOSStream() { containerElement.current && videoElement.current ) { - videoElement.current.style.height = height + 'px'; + //videoElement.current.style.width = width + 'px'; interactionHandler = new SimpleInterationHandler( videoElement.current as any, canvasElement.current, @@ -103,7 +103,7 @@ function IOSStream() { style={{ maxHeight: MAX_HEIGHT + 'px', maxWidth: MAX_WIDTH + 'px', - width: 'auto', + height: 'auto!important', position: 'absolute', backgroundImage: `url(${DeviceLoading})`, backgroundRepeat: 'no-repeat', diff --git a/web/src/libs/simple-interation-handler.ts b/web/src/libs/simple-interation-handler.ts index 6a7fafb7c..8d5d78a9d 100644 --- a/web/src/libs/simple-interation-handler.ts +++ b/web/src/libs/simple-interation-handler.ts @@ -11,7 +11,7 @@ export class SimpleInterationHandler { private scaleRatio!: number; private clickStartTime!: number; - constructor( + constructor( private videoElement: HTMLElement, touchableElement: HTMLCanvasElement, containerElement: HTMLDivElement, @@ -58,7 +58,11 @@ export class SimpleInterationHandler { this.mouseDownPoint?.y != this.mouseUpPoint?.y ) { //swipe action - const message = new SwipeControlMessage(this.mouseDownPoint as any, this.mouseUpPoint, Math.ceil(clickEndTime - this.clickStartTime)); + const message = new SwipeControlMessage( + this.mouseDownPoint as any, + this.mouseUpPoint, + Math.ceil(clickEndTime - this.clickStartTime), + ); this.controlMessageSender.send(JSON.stringify(message.toJSON())); console.log(message.toJSON()); return;