From 6625046c568230f1c7de18f21e6ded546f3e704a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ma=C5=82ecki?= <92953623+p-malecki@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:20:20 +0200 Subject: [PATCH 1/3] Block sending touch in replay view --- .../vscode-extension/src/webview/components/Preview.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/vscode-extension/src/webview/components/Preview.tsx b/packages/vscode-extension/src/webview/components/Preview.tsx index 9ef47c6d..1a5bcd4a 100644 --- a/packages/vscode-extension/src/webview/components/Preview.tsx +++ b/packages/vscode-extension/src/webview/components/Preview.tsx @@ -278,11 +278,19 @@ function Preview({ type MouseMove = "Move" | "Down" | "Up"; function sendTouch(event: MouseEvent, type: MouseMove) { + if (replayData) { + return; + } + const { x, y } = getTouchPosition(event); project.dispatchTouches([{ xRatio: x, yRatio: y }], type); } function sendMultiTouch(event: MouseEvent, type: MouseMove) { + if (replayData) { + return; + } + const pt = getTouchPosition(event); const secondPt = calculateMirroredTouchPosition(pt, anchorPoint); project.dispatchTouches( From 4915d4642f06694cac0e2a10300915740d437f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ma=C5=82ecki?= <92953623+p-malecki@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:24:20 +0200 Subject: [PATCH 2/3] Block multitouch indicator in replay view --- .../src/webview/components/Preview.tsx | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/packages/vscode-extension/src/webview/components/Preview.tsx b/packages/vscode-extension/src/webview/components/Preview.tsx index 1a5bcd4a..5db9a4d0 100644 --- a/packages/vscode-extension/src/webview/components/Preview.tsx +++ b/packages/vscode-extension/src/webview/components/Preview.tsx @@ -548,35 +548,33 @@ function Preview({ /> {replayData && } - {isMultiTouching && ( -
- -
- )} - {isMultiTouching && ( -
- -
- )} - {isMultiTouching && ( -
- -
+ {!replayData && isMultiTouching && ( + <> +
+ +
+
+ +
+
+ +
+ )} {!replayData && inspectFrame && ( From 59be3bde234476616e461d76d7f9a82476fb9abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ma=C5=82ecki?= <92953623+p-malecki@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:48:45 +0200 Subject: [PATCH 3/3] Block key dispaching in replay view --- .../vscode-extension/src/webview/components/Preview.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/vscode-extension/src/webview/components/Preview.tsx b/packages/vscode-extension/src/webview/components/Preview.tsx index 5db9a4d0..c40a7e9c 100644 --- a/packages/vscode-extension/src/webview/components/Preview.tsx +++ b/packages/vscode-extension/src/webview/components/Preview.tsx @@ -459,8 +459,11 @@ function Preview({ function keyEventHandler(e: KeyboardEvent) { if (document.activeElement === wrapperDivRef.current) { e.preventDefault(); - const isKeydown = e.type === "keydown"; + if (replayData) { + return; + } + const isKeydown = e.type === "keydown"; const isMultitouchKeyPressed = Platform.select({ macos: e.code === "AltLeft" || e.code === "AltRight", windows: e.code === "ControlLeft" || e.code === "ControlRight", @@ -484,7 +487,7 @@ function Preview({ document.removeEventListener("keydown", keyEventHandler); document.removeEventListener("keyup", keyEventHandler); }; - }, [project]); + }, [project, replayData]); useEffect(() => { if (projectStatus === "running") {