From 782c5949380826eec6fb911efa945c22b526fa44 Mon Sep 17 00:00:00 2001 From: Peter Date: Tue, 30 Jul 2019 17:24:37 +0200 Subject: [PATCH] Mobile Backport: Cursor keys emulate swipe gestures First we touch the screen and later swipe (fling) in the direction of the key pressed --- forge-gui-mobile/src/forge/Forge.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index d24e17319b4..44cab2a5976 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -462,6 +462,26 @@ public class Forge implements ApplicationListener { if (keyCode == Keys.SHIFT_LEFT || keyCode == Keys.SHIFT_RIGHT) { shiftKeyDown = true; } + + // Cursor keys emulate swipe gestures + // First we touch the screen and later swipe (fling) in the direction of the key pressed + if (keyCode == Keys.LEFT) { + touchDown(0,0,0,0); + return fling(1000,0); + } + if (keyCode == Keys.RIGHT) { + touchDown(0,0,0,0); + return fling(-1000,0); + } + if (keyCode == Keys.UP) { + touchDown(0,0,0,0); + return fling(0,-1000); + } + if (keyCode == Keys.DOWN) { + touchDown(0,0,0,0); + return fling(0,1000); + } + if (keyInputAdapter == null) { if (KeyInputAdapter.isModifierKey(keyCode)) { return false; //don't process modifiers keys for unknown adapter