X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FScalePanel.java;h=1db4051e1841e8648149326d4e72160064392c4a;hb=3d0101179759ef157b088ea135423cd909512d9f;hp=3cdba8d4c1a9cb2bfbf384461c48e6670f422858;hpb=fd8dc2879b13709703b57dd7ed4b3754b253e12f;p=jalview.git diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 3cdba8d..1db4051 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -29,6 +29,7 @@ import jalview.renderer.ScaleRenderer.ScaleMark; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.viewmodel.ViewportListenerI; +import jalview.viewmodel.ViewportRanges; import java.awt.Color; import java.awt.FontMetrics; @@ -53,8 +54,8 @@ import javax.swing.ToolTipManager; * The panel containing the sequence ruler (when not in wrapped mode), and * supports a range of mouse operations to select, hide or reveal columns. */ -public class ScalePanel extends JPanel implements MouseMotionListener, - MouseListener, ViewportListenerI +public class ScalePanel extends JPanel + implements MouseMotionListener, MouseListener, ViewportListenerI { protected int offy = 4; @@ -168,10 +169,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, av.showColumn(reveal[0]); reveal = null; ap.paintAlignment(true); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } av.sendSelection(); } }); @@ -188,10 +185,6 @@ public class ScalePanel extends JPanel implements MouseMotionListener, av.showAllHiddenColumns(); reveal = null; ap.paintAlignment(true); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } av.sendSelection(); } }); @@ -209,18 +202,13 @@ public class ScalePanel extends JPanel implements MouseMotionListener, public void actionPerformed(ActionEvent e) { av.hideColumns(res, res); - if (av.getSelectionGroup() != null - && av.getSelectionGroup().getSize() == av.getAlignment() - .getHeight()) + if (av.getSelectionGroup() != null && av.getSelectionGroup() + .getSize() == av.getAlignment().getHeight()) { av.setSelectionGroup(null); } ap.paintAlignment(true); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } av.sendSelection(); } }); @@ -421,8 +409,15 @@ public class ScalePanel extends JPanel implements MouseMotionListener, @Override public void paintComponent(Graphics g) { - drawScale(g, av.getRanges().getStartRes(), av.getRanges().getEndRes(), - getWidth(), getHeight()); + /* + * shouldn't get called in wrapped mode as the scale above is + * drawn instead by SeqCanvas.drawNorthScale + */ + if (!av.getWrapAlignment()) + { + drawScale(g, av.getRanges().getStartRes(), av.getRanges().getEndRes(), + getWidth(), getHeight()); + } } // scalewidth will normally be screenwidth, @@ -502,10 +497,13 @@ public class ScalePanel extends JPanel implements MouseMotionListener, continue; } - 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); + 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); } } } @@ -546,7 +544,16 @@ public class ScalePanel extends JPanel implements MouseMotionListener, public void propertyChange(PropertyChangeEvent evt) { // Respond to viewport change events (e.g. alignment panel was scrolled) - repaint(); + // Both scrolling and resizing change viewport ranges: scrolling changes + // both start and end points, but resize only changes end values. + // Here we only want to fastpaint on a scroll, with resize using a normal + // paint, so scroll events are identified as changes to the horizontal or + // vertical start value. + if (evt.getPropertyName().equals(ViewportRanges.STARTRES)) + { + // scroll event, repaint panel + repaint(); + } } }