JAL-2077 - reinstate popups on osx
[jalview.git] / src / jalview / gui / ScalePanel.java
index 7e17f46..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);
     }
@@ -493,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();
@@ -540,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;
           }