mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
[UI] Fixed wrong card position on d'n'd with small moves
This commit is contained in:
parent
b6e0544c95
commit
43a31f6d98
1 changed files with 12 additions and 11 deletions
|
|
@ -48,7 +48,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
public static final int GAP_X = 5;
|
public static final int GAP_X = 5;
|
||||||
public static final double COMPARE_GAP_X = 30;
|
public static final double COMPARE_GAP_X = 30;
|
||||||
public static final int GO_DOWN_ON_DRAG_Y_OFFSET = 0;
|
public static final int GO_DOWN_ON_DRAG_Y_OFFSET = 0;
|
||||||
public static final int MIN_X_OFFSET_REQUIRED = 25;
|
public static final int MIN_X_OFFSET_REQUIRED = 20;
|
||||||
|
|
||||||
private Popup popup;
|
private Popup popup;
|
||||||
private JPopupMenu jPopupMenu;
|
private JPopupMenu jPopupMenu;
|
||||||
|
|
@ -219,7 +219,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
maxXOffset = Math.abs((int) (mouse.getX() - initialMousePos.x) - xOffset);
|
maxXOffset = Math.abs((int) (mouse.getX() - initialMousePos.x) - xOffset);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (maxXOffset > MIN_X_OFFSET_REQUIRED) { // we need this for protection from small card movements
|
|
||||||
CardPanel card = ((CardPanel)transferData.component);
|
CardPanel card = ((CardPanel)transferData.component);
|
||||||
for (Component component : card.getCardArea().getComponents()) {
|
for (Component component : card.getCardArea().getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
if (component instanceof CardPanel) {
|
||||||
|
|
@ -230,7 +230,8 @@ public class MageActionCallback implements ActionCallback {
|
||||||
}
|
}
|
||||||
sort(card, card.getCardArea(), true);
|
sort(card, card.getCardArea(), true);
|
||||||
cardPanels.clear();
|
cardPanels.clear();
|
||||||
} else {
|
|
||||||
|
if (maxXOffset < MIN_X_OFFSET_REQUIRED) { // we need this for protection from small card movements
|
||||||
transferData.component.requestFocusInWindow();
|
transferData.component.requestFocusInWindow();
|
||||||
defaultCallback.mouseClicked(e, transferData.gameId, session, transferData.card);
|
defaultCallback.mouseClicked(e, transferData.gameId, session, transferData.card);
|
||||||
// Closes popup & enlarged view if a card/Permanent is selected
|
// Closes popup & enlarged view if a card/Permanent is selected
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue