[UI] Fixed wrong card position on d'n'd with small moves

This commit is contained in:
magenoxx 2014-07-14 13:30:02 +04:00
parent b6e0544c95
commit 43a31f6d98

View file

@ -48,7 +48,7 @@ public class MageActionCallback implements ActionCallback {
public static final int GAP_X = 5;
public static final double COMPARE_GAP_X = 30;
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 JPopupMenu jPopupMenu;
@ -219,7 +219,7 @@ public class MageActionCallback implements ActionCallback {
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);
for (Component component : card.getCardArea().getComponents()) {
if (component instanceof CardPanel) {
@ -230,7 +230,8 @@ public class MageActionCallback implements ActionCallback {
}
sort(card, card.getCardArea(), true);
cardPanels.clear();
} else {
if (maxXOffset < MIN_X_OFFSET_REQUIRED) { // we need this for protection from small card movements
transferData.component.requestFocusInWindow();
defaultCallback.mouseClicked(e, transferData.gameId, session, transferData.card);
// Closes popup & enlarged view if a card/Permanent is selected