From b2baa7cf6de51d098e25dc663a9090b7e961cf15 Mon Sep 17 00:00:00 2001 From: Leland Takamine Date: Mon, 23 Jan 2023 12:58:00 -0800 Subject: [PATCH] Maestro Studio - use percentage-based swiping (#660) --- maestro-studio/web/src/InteractableDevice.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/maestro-studio/web/src/InteractableDevice.tsx b/maestro-studio/web/src/InteractableDevice.tsx index 63598b624b..682160402e 100644 --- a/maestro-studio/web/src/InteractableDevice.tsx +++ b/maestro-studio/web/src/InteractableDevice.tsx @@ -108,14 +108,14 @@ const InteractableDevice = ({deviceScreen, onHint, onInspectElement}: { } const onSwipeGesture = (startX: number, startY: number, endX: number, endY: number, duration: number) => { - const startXpx = Math.round(startX * deviceScreen.width) - const startYpx = Math.round(startY * deviceScreen.height) - const endXpx = Math.round(endX * deviceScreen.width) - const endYpx = Math.round(endY * deviceScreen.height) + const startXPercent = Math.round(startX * 100) + const startYPercent = Math.round(startY * 100) + const endXPercent = Math.round(endX * 100) + const endYPercent = Math.round(endY * 100) API.repl.runCommand(` swipe: - start: "${startXpx}, ${startYpx}" - end: "${endXpx}, ${endYpx}" + start: "${startXPercent}%,${startYPercent}%" + end: "${endXPercent}%,${endYPercent}%" duration: ${Math.round(duration)} `) }