mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Avoid toggling multi-select mode if long press on card art
Avoid toggling checkbox if user taps on card art
This commit is contained in:
@@ -79,6 +79,9 @@ public class CardManager extends ItemManager<PaperCard> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(Integer index, Entry<PaperCard, Integer> value, float x, float y) {
|
public boolean longPress(Integer index, Entry<PaperCard, Integer> value, float x, float y) {
|
||||||
|
if (CardRenderer.cardListItemTap(model.getOrderedList(), index, CardManager.this, x, y, 1, compactModeHandler.isCompactMode())) {
|
||||||
|
return true; //avoid calling onCardLongPress if user long presses on card art
|
||||||
|
}
|
||||||
onCardLongPress(index, value, x, y);
|
onCardLongPress(index, value, x, y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ public class SpellShopManager extends ItemManager<InventoryItem> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean longPress(Integer index, Entry<InventoryItem, Integer> value, float x, float y) {
|
public boolean longPress(Integer index, Entry<InventoryItem, Integer> value, float x, float y) {
|
||||||
|
if (value.getKey() instanceof PaperCard && CardRenderer.cardListItemTap(model.getOrderedList(), index, SpellShopManager.this, x, y, 1, compactModeHandler.isCompactMode())) {
|
||||||
|
return true; //avoid calling toggleMultiSelectMode if user long presses on card art
|
||||||
|
}
|
||||||
toggleMultiSelectMode(index);
|
toggleMultiSelectMode(index);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,9 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tap(Integer index, Entry<T, Integer> value, float x, float y, int count) {
|
public boolean tap(Integer index, Entry<T, Integer> value, float x, float y, int count) {
|
||||||
if (maxSelections > 1) {
|
if (maxSelections > 1) { //if multi-select
|
||||||
|
//don't toggle checkbox if renderer handles tap
|
||||||
|
if (!renderer.tap(index, value, x, y, count)) {
|
||||||
if (selectedIndices.contains(index)) {
|
if (selectedIndices.contains(index)) {
|
||||||
//allow removing selection if it won't fall below min
|
//allow removing selection if it won't fall below min
|
||||||
//or if max selected (since you need to be able to deselect an item before selecting a new item)
|
//or if max selected (since you need to be able to deselect an item before selecting a new item)
|
||||||
@@ -215,14 +217,12 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
onSelectionChange();
|
onSelectionChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
else { //if single-select
|
||||||
setSelectedIndex(index);
|
setSelectedIndex(index);
|
||||||
}
|
|
||||||
if (renderer.tap(index, value, x, y, count)) {
|
//don't activate if renderer handles tap
|
||||||
prevTapIndex = index;
|
if (!renderer.tap(index, value, x, y, count)) {
|
||||||
return true; //don't activate if renderer handles tap
|
|
||||||
}
|
|
||||||
if (maxSelections <= 1) {
|
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
itemManager.showMenu(false);
|
itemManager.showMenu(false);
|
||||||
}
|
}
|
||||||
@@ -230,6 +230,8 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
itemManager.activateSelectedItems();
|
itemManager.activateSelectedItems();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
prevTapIndex = index;
|
prevTapIndex = index;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user