use of mage.client.MagePane in project mage by magefree.
the class MageActionCallback method handleMouseMoveOverNewCard.
private void handleMouseMoveOverNewCard(TransferData data) {
MageCard cardPanel = data.getComponent().getTopPanelRef();
// Prevent to show tooltips from panes not in front
MagePane topPane = MageFrame.getTopMost(null);
if (topPane instanceof GamePane) {
if (data.getGameId() != null && !((GamePane) topPane).getGameId().equals(data.getGameId())) {
return;
}
}
hideTooltipPopup();
cancelTimeout();
Component parentComponent = SwingUtilities.getRoot(cardPanel);
if (parentComponent == null) {
// virtual card (example: show card popup in non cards panel like PickChoiceDialog)
parentComponent = MageFrame.getDesktop();
}
Point parentPoint = parentComponent.getLocationOnScreen();
if (data.getLocationOnScreen() == null) {
data.setLocationOnScreen(cardPanel.getCardLocationOnScreen().getCardPoint());
}
ArrowUtil.drawArrowsForTargets(data, parentPoint);
ArrowUtil.drawArrowsForSource(data, parentPoint);
ArrowUtil.drawArrowsForPairedCards(data, parentPoint);
ArrowUtil.drawArrowsForBandedCards(data, parentPoint);
ArrowUtil.drawArrowsForEnchantPlayers(data, parentPoint);
tooltipCard = data.getCard();
startCardHintPopup(data, parentComponent, parentPoint);
}