mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Support highlighting options when dragging up
This commit is contained in:
@@ -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,14 +92,18 @@ public class InputSelectCard {
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
CardOptionsList<?>.ListItem item = visibleList.getItemAt(index);
|
||||
if (item != null) {
|
||||
if (isPanStop) {
|
||||
visibleList.getItemAt(index).tap(0, 0, 1);
|
||||
item.tap(0, 0, 1);
|
||||
}
|
||||
else {
|
||||
//visibleList.getItemAt(index).press(0, 0);
|
||||
item.press(0, 0);
|
||||
pressedItem = item;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user