Restore misunderstood functionality to desktop card viewer (#3985)

This commit is contained in:
tool4ever
2023-10-26 16:17:04 +02:00
committed by GitHub
parent a5e3a43b84
commit aa1c3dd45e
3 changed files with 16 additions and 5 deletions

View File

@@ -62,6 +62,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
private Point hoverScrollPos; private Point hoverScrollPos;
private ItemInfo hoveredItem; private ItemInfo hoveredItem;
private ItemInfo focalItem; private ItemInfo focalItem;
private InventoryItem lastAltCard = null;
private boolean panelOptionsCreated = false; private boolean panelOptionsCreated = false;
private final List<ItemInfo> orderedItems = new ArrayList<>(); private final List<ItemInfo> orderedItems = new ArrayList<>();
@@ -1109,9 +1110,19 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
InventoryItem item = itemInfo.item; InventoryItem item = itemInfo.item;
itemInfo.alt = false; itemInfo.alt = false;
if (!FModel.getPreferences().getPref(FPref.UI_SWITCH_STATES_DECKVIEW).equals(ForgeConstants.SWITCH_CARDSTATES_DECK_NEVER)) { if (!FModel.getPreferences().getPref(FPref.UI_SWITCH_STATES_DECKVIEW).equals(ForgeConstants.SWITCH_CARDSTATES_DECK_NEVER)) {
if (hoveredItem != null && hoveredItem.item.equals(item)) { if ((hoveredItem == null || !hoveredItem.item.equals(item)) || (FModel.getPreferences().getPref(FPref.UI_SWITCH_STATES_DECKVIEW).equals(ForgeConstants.SWITCH_CARDSTATES_DECK_ALWAYS))) {
if (item instanceof PaperCard && ((PaperCard)item).hasBackFace()) if (item instanceof PaperCard) {
itemInfo.alt = true; if (((PaperCard)item).hasBackFace()) {
if (item.equals(lastAltCard)) {
itemInfo.alt = true;
lastAltCard = null;
} else {
lastAltCard = item;
}
} else {
lastAltCard = null;
}
}
} }
} }

View File

@@ -573,7 +573,7 @@ public enum CSubmenuPreferences implements ICDoc {
} }
private void initializeSwitchStatesCombobox() { private void initializeSwitchStatesCombobox() {
final String[] elems = {ForgeConstants.SWITCH_CARDSTATES_DECK_NEVER, ForgeConstants.SWITCH_CARDSTATES_DECK_HOVER}; final String[] elems = {ForgeConstants.SWITCH_CARDSTATES_DECK_NEVER, ForgeConstants.SWITCH_CARDSTATES_DECK_HOVER, ForgeConstants.SWITCH_CARDSTATES_DECK_ALWAYS};
final FPref userSetting = FPref.UI_SWITCH_STATES_DECKVIEW; final FPref userSetting = FPref.UI_SWITCH_STATES_DECKVIEW;
final FComboBoxPanel<String> panel = this.view.getSwitchStates(); final FComboBoxPanel<String> panel = this.view.getSwitchStates();
final FComboBox<String> comboBox = createComboBox(elems, userSetting); final FComboBox<String> comboBox = createComboBox(elems, userSetting);

View File

@@ -465,8 +465,8 @@ public final class ForgeConstants {
public static final String LAND_PLAYED_NOTIFICATION_AI = "Lands entering a battlefield because of an action of a AI player"; public static final String LAND_PLAYED_NOTIFICATION_AI = "Lands entering a battlefield because of an action of a AI player";
public static final String LAND_PLAYED_NOTIFICATION_AI_FOR_NONBASIC_LANDS = "Nonbasic lands entering a battlefield because of an action of a AI player"; public static final String LAND_PLAYED_NOTIFICATION_AI_FOR_NONBASIC_LANDS = "Nonbasic lands entering a battlefield because of an action of a AI player";
// Constants for Land played notification policy
public static final String SWITCH_CARDSTATES_DECK_NEVER = "Never"; public static final String SWITCH_CARDSTATES_DECK_NEVER = "Never";
public static final String SWITCH_CARDSTATES_DECK_ALWAYS = "Always";
public static final String SWITCH_CARDSTATES_DECK_HOVER = "Switch back on hover"; public static final String SWITCH_CARDSTATES_DECK_HOVER = "Switch back on hover";
// Set boolean constant for landscape mode for gdx port // Set boolean constant for landscape mode for gdx port