JAL-3208 re-enable the setprop CLI arg, but only in JalviewJS
[jalview.git] / src / jalview / gui / ScalePanel.java
index 8771119..6912a02 100755 (executable)
@@ -132,8 +132,9 @@ public class ScalePanel extends JPanel
     if (evt.isPopupTrigger()) // Mac: mousePressed
     {
       rightMouseButtonPressed(evt, res);
+      return;
     }
-    else if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac())
+    if (Platform.isWinRightButton(evt))
     {
       /*
        * defer right-mouse click handling to mouse up on Windows
@@ -142,10 +143,7 @@ public class ScalePanel extends JPanel
        */
       return;
     }
-    else
-    {
-      leftMouseButtonPressed(evt, res);
-    }
+    leftMouseButtonPressed(evt, res);
   }
 
   /**
@@ -279,8 +277,11 @@ public class ScalePanel extends JPanel
     ap.getSeqPanel().stopScrolling();
 
     // todo res calculation should be a method on AlignViewport
-    int res = (evt.getX() / av.getCharWidth())
+    int xCords = Math.max(0, evt.getX()); // prevent negative X coordinates
+
+    int res = (xCords / av.getCharWidth())
             + av.getRanges().getStartRes();
+
     if (av.hasHiddenColumns())
     {
       res = av.getAlignment().getHiddenColumns()
@@ -415,7 +416,7 @@ public class ScalePanel extends JPanel
   @Override
   public void paintComponent(Graphics g)
   {
-    super.paintComponent(g);
+    //super.paintComponent(g);  // BH 2019
 
     /*
      * shouldn't get called in wrapped mode as the scale above is