diff --git a/Mage.Client/src/main/java/mage/client/components/ColorPane.java b/Mage.Client/src/main/java/mage/client/components/ColorPane.java index 02abda56756..deb15736e7d 100644 --- a/Mage.Client/src/main/java/mage/client/components/ColorPane.java +++ b/Mage.Client/src/main/java/mage/client/components/ColorPane.java @@ -4,7 +4,10 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; +import java.awt.MouseInfo; import java.awt.Point; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import javax.swing.JEditorPane; import javax.swing.JPanel; @@ -57,23 +60,12 @@ public class ColorPane extends JEditorPane { try { final Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER); if (e.getEventType() == EventType.EXITED) { - setPopupVisibility(null, container, false); + setPopupVisibility(container, false); } if (e.getEventType() == EventType.ENTERED) { CardInfoPane cardInfoPane = (CardInfoPane) MageFrame.getUI().getComponent(MageComponents.CARD_INFO_PANE); cardInfoPane.setCard(new CardView(card.getMockCard()), container); - Point mousePosition = MageFrame.getDesktop().getMousePosition(); - int popupY = 0; - if (mousePosition == null) { // switched to another window - popupY = getLocationOnScreen().y; - } else { - popupY = mousePosition.y; - } - Point location = new Point(getLocationOnScreen().x - container.getWidth(), popupY); - Component parentComponent = MageFrame.getInstance(); - location = GuiDisplayUtil.keepComponentInsideParent(location, parentComponent.getLocationOnScreen(), - container, parentComponent); - setPopupVisibility(location, container, true); + setPopupVisibility(container, true); } } catch (InterruptedException e1) { e1.printStackTrace(); @@ -83,20 +75,37 @@ public class ColorPane extends JEditorPane { }); } - private void setPopupVisibility(final Point location, final Component container, final boolean show) - throws InterruptedException { - final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (location != null) { - container.setLocation(location); - } - tooltipCounter += show ? 1 : -1; - container.setVisible(tooltipCounter > 0); - c.repaint(); - } - }); + }); + + addMouseListener(new MouseAdapter() { + @Override + public void mouseExited(MouseEvent e) { + tooltipCounter = 1; // will decrement and become effectively zero on leaving the pane + try { + setPopupVisibility(MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER), false); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + }); + } + + private void setPopupVisibility(final Component container, final boolean show) + throws InterruptedException { + final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + Point location = new Point(getLocationOnScreen().x - container.getWidth(), MouseInfo.getPointerInfo().getLocation().y); + Component parentComponent = MageFrame.getInstance(); + location = GuiDisplayUtil.keepComponentInsideParent(location, parentComponent.getLocationOnScreen(), container, parentComponent); + container.setLocation(location); + tooltipCounter += show ? 1 : -1; + if (tooltipCounter < 0) { + tooltipCounter = 0; + } + container.setVisible(tooltipCounter > 0); + c.repaint(); } }); } diff --git a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java index 015280b3d3b..356b5090bce 100644 --- a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java @@ -182,24 +182,14 @@ public class MageActionCallback implements ActionCallback { ((CardInfoPane) popup2).setCard(data.card, popupContainer); - 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, popup2, parentComponent); - location.translate(-parentPoint.x, -parentPoint.y); - - ThreadUtils.sleep(200); - - showPopup(popupContainer, location); + showPopup(popupContainer, popup2); } catch (InterruptedException e) { LOGGER.warn(e.getMessage()); } } - public void showPopup(final Component popupContainer, final Point location) throws InterruptedException { + public void showPopup(final Component popupContainer, final Component infoPane) throws InterruptedException { final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE); SwingUtilities.invokeLater(new Runnable() { @Override @@ -207,6 +197,13 @@ public class MageActionCallback implements ActionCallback { if (!popupTextWindowOpen || !enlargedWindowState.equals(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(); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java index 1d2e242aa2a..b8d6ed8bc15 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java @@ -8,7 +8,6 @@ import mage.client.util.GUISizeHelper; import mage.client.util.gui.GuiDisplayUtil; import mage.client.util.gui.GuiDisplayUtil.TextLines; import mage.components.CardInfoPane; -import mage.utils.ThreadUtils; import mage.view.CardView; import org.mage.card.arcane.UI; diff --git a/Mage.Sets/src/mage/sets/worldwake/TuktukScrapper.java b/Mage.Sets/src/mage/sets/worldwake/TuktukScrapper.java index 2a22757c2ef..e5e90bb5f13 100644 --- a/Mage.Sets/src/mage/sets/worldwake/TuktukScrapper.java +++ b/Mage.Sets/src/mage/sets/worldwake/TuktukScrapper.java @@ -113,7 +113,12 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "Whenever {this} or another Ally enters the battlefield under your control, you may destroy target artifact. If that artifact is put into a graveyard this way, {this} deals damage to that artifact's controller equal to the number of Allies you control."; + + // originally returned fullText, user reported that because the trigger text is so lengthy, they cannot click Yes/No buttons + //String fullText = "Whenever {this} or another Ally enters the battlefield under your control, you may destroy target artifact. If that artifact is put into a graveyard this way, {this} deals damage to that artifact's controller equal to the number of Allies you control."; + String condensedText = "Whenever {this} or another Ally you enters the battlefield under your control, you may destroy target artifact. If you do, {this} deals damage to that controller equal to the number of Allies you control."; + + return condensedText; } } diff --git a/Utils/release/startMage.sh b/Utils/release/startMage.sh index a8093bff508..a737503b042 100644 --- a/Utils/release/startMage.sh +++ b/Utils/release/startMage.sh @@ -1,5 +1,5 @@ #!/bin/sh -cd ./client +cd ./mage-client ./startClient.sh -cd ../server -./startServer.sh \ No newline at end of file +cd ../mage-server +./startServer.sh