private AlignViewportI av;
+ private boolean resize = false;
+
public OverviewCanvas(OverviewDimensions overviewDims,
AlignViewportI alignvp)
{
@Override
public void paintComponent(Graphics g)
{
+
if (restart)
{
if (lastMiniMe == null)
&& ((getWidth() != od.getWidth())
|| (getHeight() != od.getHeight())))
{
+ resize = true;
+
// scale the alignment and annotation separately *** if there is
// annotation ***
if (od.getGraphHeight() > 0)
// 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();
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);
}
}
@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();
}
});