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 ItemInfo hoveredItem;
private ItemInfo focalItem;
private InventoryItem lastAltCard = null;
private boolean panelOptionsCreated = false;
private final List<ItemInfo> orderedItems = new ArrayList<>();
@@ -1109,9 +1110,19 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
InventoryItem item = itemInfo.item;
itemInfo.alt = false;
if (!FModel.getPreferences().getPref(FPref.UI_SWITCH_STATES_DECKVIEW).equals(ForgeConstants.SWITCH_CARDSTATES_DECK_NEVER)) {
if (hoveredItem != null && hoveredItem.item.equals(item)) {
if (item instanceof PaperCard && ((PaperCard)item).hasBackFace())
itemInfo.alt = true;
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) {
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() {
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 FComboBoxPanel<String> panel = this.view.getSwitchStates();
final FComboBox<String> comboBox = createComboBox(elems, userSetting);