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 {
|
public class InputSelectCard {
|
||||||
private static final float LIST_OPTION_HEIGHT = Utils.AVG_FINGER_HEIGHT;
|
private static final float LIST_OPTION_HEIGHT = Utils.AVG_FINGER_HEIGHT;
|
||||||
private static CardOptionsList<?> visibleList;
|
private static CardOptionsList<?> visibleList;
|
||||||
|
private static CardOptionsList<?>.ListItem pressedItem;
|
||||||
|
|
||||||
private InputSelectCard() {
|
private InputSelectCard() {
|
||||||
}
|
}
|
||||||
@@ -79,6 +80,10 @@ public class InputSelectCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean handlePan(CardAreaPanel cardPanel, float x, float y, boolean isPanStop) {
|
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) {
|
if (visibleList == null || visibleList.owner != cardPanel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -87,14 +92,18 @@ public class InputSelectCard {
|
|||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
CardOptionsList<?>.ListItem item = visibleList.getItemAt(index);
|
||||||
|
if (item != null) {
|
||||||
if (isPanStop) {
|
if (isPanStop) {
|
||||||
visibleList.getItemAt(index).tap(0, 0, 1);
|
item.tap(0, 0, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//visibleList.getItemAt(index).press(0, 0);
|
item.press(0, 0);
|
||||||
|
pressedItem = item;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user