JAL-2077 - reinstate popups on osx
[jalview.git] / src / jalview / gui / ScalePanel.java
index b2c9a12..3ab681c 100755 (executable)
@@ -39,7 +39,6 @@ import java.awt.event.MouseMotionListener;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
 import javax.swing.ToolTipManager;
 
 /**
@@ -107,7 +106,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
     min = res;
     max = res;
 
-    if (SwingUtilities.isRightMouseButton(evt))
+    if (evt.isPopupTrigger())
     {
       rightMouseButtonPressed(evt, res);
     }
@@ -467,6 +466,9 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
 
       for (int sel : cs.getSelected())
       {
+        // TODO: JAL-2001 - provide a fast method to list visible selected in a
+        // given range
+
         if (av.hasHiddenColumns())
         {
           if (cs.isVisible(sel))
@@ -490,6 +492,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
     gg.setColor(Color.black);
 
     int scalestartx = (startx / 10) * 10;
+    int widthx = 1 + endx - startx;
 
     FontMetrics fm = gg.getFontMetrics(av.getFont());
     int y = avCharHeight - fm.getDescent();
@@ -537,11 +540,10 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
         for (int i = 0; i < av.getColumnSelection().getHiddenColumns()
                 .size(); i++)
         {
-
           res = av.getColumnSelection().findHiddenRegionPosition(i)
                   - startx;
 
-          if (res < 0 || res > endx - scalestartx)
+          if (res < 0 || res > widthx)
           {
             continue;
           }