JAL-3541 selectively merged build.gradle and gradle.properties
[jalview.git] / src / jalview / gui / ScalePanel.java
index 8f49c6c..a6b4b49 100755 (executable)
@@ -48,7 +48,6 @@ import java.util.List;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
-import javax.swing.SwingUtilities;
 import javax.swing.ToolTipManager;
 
 /**
@@ -123,8 +122,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
@@ -133,10 +133,7 @@ public class ScalePanel extends JPanel
        */
       return;
     }
-    else
-    {
-      leftMouseButtonPressed(evt, res);
-    }
+    leftMouseButtonPressed(evt, res);
   }
 
   /**
@@ -287,6 +284,7 @@ public class ScalePanel extends JPanel
     mouseDragging = false;
     ap.getSeqPanel().stopScrolling();
 
+    // todo res calculation should be a method on AlignViewport
     int xCords = Math.max(0, evt.getX()); // prevent negative X coordinates
     ViewportRanges ranges = av.getRanges();
     int res = (xCords / av.getCharWidth())
@@ -376,6 +374,7 @@ public class ScalePanel extends JPanel
   {
     if (mouseDragging)
     {
+      mouseDragging = false;
       ap.getSeqPanel().stopScrolling();
     }
   }
@@ -436,7 +435,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