mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Support using Escape to cancel card selection
This commit is contained in:
@@ -55,7 +55,7 @@ public class InputSelectCard {
|
||||
}
|
||||
return; //don't select already selected card
|
||||
}
|
||||
CardOptionsList.hide(); //hide previous card options list before showing a new one
|
||||
hide(); //hide previous card options list before showing a new one
|
||||
}
|
||||
|
||||
lastSelectTime = now;
|
||||
@@ -94,6 +94,18 @@ public class InputSelectCard {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hide() {
|
||||
if (activeList == null) { return false; }
|
||||
FControl.getView().remove(activeList);
|
||||
FControl.getView().remove(CardOptionsList.backdrop);
|
||||
activeList = null;
|
||||
zoomPressed = false;
|
||||
detailsPressed = false;
|
||||
ownerPressed = false;
|
||||
pannedOverOptions = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean handlePan(CardAreaPanel cardPanel, float x, float y, boolean isPanStop) {
|
||||
if (simulatedListPress) {
|
||||
//prevent pressed item getting stuck
|
||||
@@ -213,17 +225,6 @@ public class InputSelectCard {
|
||||
owner = owner0;
|
||||
}
|
||||
|
||||
public static void hide() {
|
||||
if (activeList == null) { return; }
|
||||
FControl.getView().remove(activeList);
|
||||
FControl.getView().remove(backdrop);
|
||||
activeList = null;
|
||||
zoomPressed = false;
|
||||
detailsPressed = false;
|
||||
ownerPressed = false;
|
||||
pannedOverOptions = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(Graphics g) {
|
||||
g.fillRect(BACK_COLOR, 0, 0, getWidth(), getHeight());
|
||||
|
||||
@@ -176,7 +176,10 @@ public class MatchScreen extends FScreen {
|
||||
}
|
||||
return prompt.getBtnCancel().trigger(); //trigger Cancel if can't trigger OK
|
||||
case Keys.ESCAPE:
|
||||
return prompt.getBtnCancel().trigger(); //trigger Cancel on Escape
|
||||
if (InputSelectCard.hide()) { //hide card selection if one active on Escape
|
||||
return true;
|
||||
}
|
||||
return prompt.getBtnCancel().trigger(); //otherwise trigger Cancel
|
||||
}
|
||||
return super.keyDown(keyCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user