* Fixed a problem that a tooltip window was shown of cards from panels in the back.

This commit is contained in:
LevelX2 2018-03-16 00:28:12 +01:00
parent 3c57115c1e
commit 753e039d02
2 changed files with 13 additions and 1 deletions

View file

@ -613,7 +613,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
}
}
private static MagePane getTopMost(MagePane exclude) {
public static MagePane getTopMost(MagePane exclude) {
MagePane topmost = null;
int best = Integer.MAX_VALUE;
for (Component frame : desktopPane.getComponentsInLayer(JLayeredPane.DEFAULT_LAYER)) {

View file

@ -26,10 +26,12 @@ import mage.cards.MageCard;
import mage.cards.action.ActionCallback;
import mage.cards.action.TransferData;
import mage.client.MageFrame;
import mage.client.MagePane;
import mage.client.SessionHandler;
import mage.client.cards.BigCard;
import mage.client.components.MageComponents;
import mage.client.dialog.PreferencesDialog;
import mage.client.game.GamePane;
import mage.client.plugins.impl.Plugins;
import mage.client.util.DefaultActionCallback;
import mage.client.util.gui.ArrowBuilder;
@ -367,6 +369,16 @@ public class MageActionCallback implements ActionCallback {
}
private void handleOverNewView(TransferData data) {
// Prevent to show tooltips from panes not in front
MagePane topPane = MageFrame.getTopMost(null);
if (topPane instanceof GamePane) {
if (!((GamePane) topPane).getGameId().equals(data.gameId)) {
return;
}
} else if (data.gameId != null) {
return;
}
hideTooltipPopup();
cancelTimeout();
Component parentComponent = SwingUtilities.getRoot(data.component);