mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Fixed null pointer exception problems in client.
This commit is contained in:
parent
4d60685c05
commit
3cc157bc2c
2 changed files with 25 additions and 27 deletions
|
|
@ -22,7 +22,6 @@ import javax.swing.JPopupMenu;
|
|||
import javax.swing.Popup;
|
||||
import javax.swing.PopupFactory;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.cards.action.TransferData;
|
||||
|
|
@ -177,21 +176,21 @@ public class MageActionCallback implements ActionCallback {
|
|||
public void showPopup(final Component popupContainer, final Component infoPane) throws InterruptedException {
|
||||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (!popupTextWindowOpen
|
||||
|| enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
if (data.locationOnScreen == null) {
|
||||
data.locationOnScreen = data.component.getLocationOnScreen();
|
||||
}
|
||||
if (!popupTextWindowOpen
|
||||
|| enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
return;
|
||||
}
|
||||
if (data.locationOnScreen == null) {
|
||||
data.locationOnScreen = data.component.getLocationOnScreen();
|
||||
}
|
||||
|
||||
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, infoPane, parentComponent);
|
||||
location.translate(-parentPoint.x, -parentPoint.y);
|
||||
popupContainer.setLocation(location);
|
||||
popupContainer.setVisible(true);
|
||||
c.repaint();
|
||||
}
|
||||
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, infoPane, parentComponent);
|
||||
location.translate(-parentPoint.x, -parentPoint.y);
|
||||
popupContainer.setLocation(location);
|
||||
popupContainer.setVisible(true);
|
||||
c.repaint();
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
@ -463,7 +462,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
int notches = e.getWheelRotation();
|
||||
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||
// same move direction will be ignored, opposite direction closes the enlarged window
|
||||
if (new Date().getTime() - enlargeredViewOpened.getTime() > 1000) {
|
||||
if (enlargeredViewOpened != null && new Date().getTime() - enlargeredViewOpened.getTime() > 1000) {
|
||||
// if the opening is back more than 1 seconds close anyway
|
||||
hideEnlargedCard();
|
||||
handleOverNewView(transferData);
|
||||
|
|
@ -491,7 +490,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
* Show the big card image on mouse position while hovering over a card
|
||||
*
|
||||
* @param showAlternative defines if the original image (if it's a copied
|
||||
* card) or the opposite side of a transformable card will be shown
|
||||
* card) or the opposite side of a transformable card will be shown
|
||||
*/
|
||||
public void enlargeCard(EnlargeMode showAlternative) {
|
||||
if (enlargedWindowState == EnlargedWindowState.CLOSED) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue