From: gmungoc Date: Thu, 18 Aug 2016 10:08:23 +0000 (+0100) Subject: JAL-2077 handling Cmd-click in scale panel for Mac / Windows X-Git-Tag: Release_2_10_0~100^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ce21c3bd8e2aa1937541b60cc775ffa99229feaf;p=jalview.git JAL-2077 handling Cmd-click in scale panel for Mac / Windows --- diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index e231c6f..316b6be 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -26,6 +26,7 @@ import jalview.datamodel.SequenceI; import jalview.renderer.ScaleRenderer; import jalview.renderer.ScaleRenderer.ScaleMark; import jalview.util.MessageManager; +import jalview.util.Platform; import java.awt.Color; import java.awt.FontMetrics; @@ -221,7 +222,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, */ protected void leftMouseButtonPressed(MouseEvent evt, final int res) { - if (!evt.isControlDown() && !evt.isShiftDown()) + if (!Platform.isControlDown(evt) && !evt.isShiftDown()) { av.getColumnSelection().clear(); } diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 786f5bf..85a27f6 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -78,10 +78,21 @@ public class Platform return f.toString(); } + /** + * Answers true if the mouse event has Meta-down (on Mac) or Ctrl-down (on + * other o/s) + * + * @param e + * @return + */ public static boolean isControlDown(MouseEvent e) { - return (jalview.util.Platform.isAMac() ? (Toolkit.getDefaultToolkit() - .getMenuShortcutKeyMask() & e.getModifiers()) != 0 : e - .isControlDown()); + if (isAMac()) + { + return (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() & e + .getModifiers()) != 0; + // could we use e.isMetaDown() here? + } + return e.isControlDown(); } }