From d5e4fb9fd699f18b013db10d796e69ce76e1a9cc Mon Sep 17 00:00:00 2001 From: drdev Date: Wed, 16 Apr 2014 22:45:13 +0000 Subject: [PATCH] Support highlighting options when dragging up --- .../forge/screens/match/InputSelectCard.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/forge-gui-mobile/src/forge/screens/match/InputSelectCard.java b/forge-gui-mobile/src/forge/screens/match/InputSelectCard.java index c48a4cb3f40..94b97ba86a0 100644 --- a/forge-gui-mobile/src/forge/screens/match/InputSelectCard.java +++ b/forge-gui-mobile/src/forge/screens/match/InputSelectCard.java @@ -28,6 +28,7 @@ import forge.util.Utils; public class InputSelectCard { private static final float LIST_OPTION_HEIGHT = Utils.AVG_FINGER_HEIGHT; private static CardOptionsList visibleList; + private static CardOptionsList.ListItem pressedItem; private InputSelectCard() { } @@ -79,6 +80,10 @@ public class InputSelectCard { } public static boolean handlePan(CardAreaPanel cardPanel, float x, float y, boolean isPanStop) { + if (pressedItem != null) { + pressedItem.release(x, y); //prevent pressed item getting stuck + pressedItem = null; + } if (visibleList == null || visibleList.owner != cardPanel) { return false; } @@ -87,13 +92,17 @@ public class InputSelectCard { if (index < 0) { index = 0; } - if (isPanStop) { - visibleList.getItemAt(index).tap(0, 0, 1); + CardOptionsList.ListItem item = visibleList.getItemAt(index); + if (item != null) { + if (isPanStop) { + item.tap(0, 0, 1); + } + else { + item.press(0, 0); + pressedItem = item; + } + return true; } - else { - //visibleList.getItemAt(index).press(0, 0); - } - return true; } return false; }