X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FScalePanel.java;h=ca3faf8542713b4edc9de4bff65ed7401628e53c;hb=f96e6a945e2df8a844f428c08cfc08210d937fc0;hp=8f49c6ce11342e657583914aa1d93fcc9ce09718;hpb=961e285f3c6769a3d68152a7784d85f6e814cafb;p=jalview.git diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 8f49c6c..ca3faf8 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -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); } /** @@ -190,7 +187,8 @@ public class ScalePanel extends JPanel }); pop.add(item); - if (av.getAlignment().getHiddenColumns().hasMultiHiddenColumnRegions()) + if (av.getAlignment().getHiddenColumns() + .hasMultiHiddenColumnRegions()) { item = new JMenuItem(MessageManager.getString("action.reveal_all")); item.addActionListener(new ActionListener() @@ -287,10 +285,10 @@ 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()) - + ranges.getStartRes(); + int res = (xCords / av.getCharWidth()) + ranges.getStartRes(); res = Math.min(res, ranges.getEndRes()); if (av.hasHiddenColumns()) { @@ -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 @@ -524,10 +523,11 @@ public class ScalePanel extends JPanel gg.fillPolygon( new int[] - { -1 + res * avCharWidth - avCharHeight / 4, - -1 + res * avCharWidth + avCharHeight / 4, - -1 + res * avCharWidth }, new int[] - { y, y, y + 2 * yOf }, 3); + { -1 + res * avCharWidth - avCharHeight / 4, + -1 + res * avCharWidth + avCharHeight / 4, + -1 + res * avCharWidth }, + new int[] + { y, y, y + 2 * yOf }, 3); } } } @@ -578,10 +578,11 @@ public class ScalePanel extends JPanel || evt.getPropertyName().equals(ViewportRanges.MOVE_VIEWPORT)) { // scroll event, repaint panel - - // Call repaint on alignment panel so that repaints from other alignment - // panel components can be aggregated. Otherwise performance of the overview - // window and others may be adversely affected. + + // Call repaint on alignment panel so that repaints from other alignment + // panel components can be aggregated. Otherwise performance of the + // overview + // window and others may be adversely affected. av.getAlignPanel().repaint(); } }