mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
GUI: fixed rare error while draging/moving card on first play (close #13201)
This commit is contained in:
parent
281086bbeb
commit
fbd5cca14a
1 changed files with 7 additions and 2 deletions
|
|
@ -98,8 +98,8 @@ public class MageActionCallback implements ActionCallback {
|
||||||
private MageCard prevCardPanel;
|
private MageCard prevCardPanel;
|
||||||
private boolean startedDragging;
|
private boolean startedDragging;
|
||||||
private boolean isDragging; // TODO: remove drag hand code to the hand panels
|
private boolean isDragging; // TODO: remove drag hand code to the hand panels
|
||||||
private Point initialCardPos;
|
private Point initialCardPos = null;
|
||||||
private Point initialMousePos;
|
private Point initialMousePos = null;
|
||||||
private final Set<MageCard> draggingCards = new HashSet<>();
|
private final Set<MageCard> draggingCards = new HashSet<>();
|
||||||
|
|
||||||
public MageActionCallback() {
|
public MageActionCallback() {
|
||||||
|
|
@ -351,6 +351,11 @@ public class MageActionCallback implements ActionCallback {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.initialMousePos == null || this.initialCardPos == null) {
|
||||||
|
// only allow really mouse pressed, e.g. ignore draft/game update on active card draging/pressing
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Point mouse = new Point(e.getX(), e.getY());
|
Point mouse = new Point(e.getX(), e.getY());
|
||||||
SwingUtilities.convertPointToScreen(mouse, data.getComponent());
|
SwingUtilities.convertPointToScreen(mouse, data.getComponent());
|
||||||
if (!isDragging
|
if (!isDragging
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue