Fix first card tooltip show.

This commit is contained in:
rkfg 2016-03-02 14:48:44 +03:00
parent 385313bd64
commit 5b9a38bf22
3 changed files with 76 additions and 60 deletions

View file

@ -189,27 +189,31 @@ public class MageActionCallback implements ActionCallback {
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, popup2, parentComponent);
location.translate(-parentPoint.x, -parentPoint.y);
popupContainer.setLocation(location);
ThreadUtils.sleep(200);
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (!popupTextWindowOpen || !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
return;
}
popupContainer.setVisible(true);
c.repaint();
}
}
);
showPopup(popupContainer, location);
} catch (InterruptedException e) {
LOGGER.warn(e.getMessage());
}
}
public void showPopup(final Component popupContainer, final Point location) throws InterruptedException {
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (!popupTextWindowOpen || !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
return;
}
popupContainer.setLocation(location);
popupContainer.setVisible(true);
c.repaint();
}
}
);
}
});
}