From: kiramt Date: Fri, 28 Jul 2017 15:13:37 +0000 (+0200) Subject: JAL-2587 First working attempt X-Git-Tag: Release_2_10_2b1~4^2^2~18 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b6d4e801a1e2a9a81b44f457ce7e7673e5ad646e;p=jalview.git JAL-2587 First working attempt --- diff --git a/src/jalview/gui/OverviewCanvas.java b/src/jalview/gui/OverviewCanvas.java index 14ffad6..694f804 100644 --- a/src/jalview/gui/OverviewCanvas.java +++ b/src/jalview/gui/OverviewCanvas.java @@ -57,6 +57,8 @@ public class OverviewCanvas extends JComponent private AlignViewportI av; + private boolean resize = false; + public OverviewCanvas(OverviewDimensions overviewDims, AlignViewportI alignvp) { @@ -164,6 +166,7 @@ public class OverviewCanvas extends JComponent @Override public void paintComponent(Graphics g) { + if (restart) { if (lastMiniMe == null) @@ -184,6 +187,8 @@ public class OverviewCanvas extends JComponent && ((getWidth() != od.getWidth()) || (getHeight() != od.getHeight()))) { + resize = true; + // scale the alignment and annotation separately *** if there is // annotation *** if (od.getGraphHeight() > 0) @@ -199,7 +204,7 @@ public class OverviewCanvas extends JComponent // stick the images back together so lastMiniMe is consistent in the // event - // of a repaint + // of a repaint - BUT probably not thread safe lastMiniMe = new BufferedImage(od.getWidth(), od.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics lg = lastMiniMe.getGraphics(); @@ -210,26 +215,30 @@ public class OverviewCanvas extends JComponent lg.dispose(); } - g.drawImage(lastMiniMe, 0, 0, od.getWidth(), od.getHeight(), null); + // scale lastMiniMe to the new size + g.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this); + + // make sure the box is in the right place + od.setBoxPosition(av.getAlignment().getHiddenSequences(), + av.getAlignment().getHiddenColumns()); } else { + System.out.println("Same size"); g.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this); - if (lastMiniMe != miniMe) + if (lastMiniMe != miniMe && !resize) { g.setColor(TRANS_GREY); g.fillRect(0, 0, getWidth(), getHeight()); } + resize = false; } } + // draw the box g.setColor(Color.red); - - od.setBoxPosition(av.getAlignment().getHiddenSequences(), - av.getAlignment().getHiddenColumns()); - od.drawBox(g); } } diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index fe57621..37abb8c 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -93,21 +93,7 @@ public class OverviewPanel extends JPanel implements Runnable, @Override public void componentResized(ComponentEvent evt) { - /* if ((getWidth() != od.getWidth()) - || (getHeight() != (od.getHeight()))) - { - if ((getWidth() > 0) && (getHeight() > 0)) - { - od.setWidth(getWidth()); - od.setHeight(getHeight()); - } - - - setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); - */ - updateOverviewImage(); - // setBoxPosition(); - // } + updateOverviewImage(); } });