From: kiramt Date: Fri, 4 Aug 2017 13:28:43 +0000 (+0100) Subject: JAL-2587 First working effort X-Git-Tag: Release_2_10_2b1~4^2^2~16 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8ca8e3e3539ccd958a0dfb90b1ed8bac218e57b1;p=jalview.git JAL-2587 First working effort --- diff --git a/src/jalview/gui/OverviewCanvas.java b/src/jalview/gui/OverviewCanvas.java index 3bd365e..8f8cff7 100644 --- a/src/jalview/gui/OverviewCanvas.java +++ b/src/jalview/gui/OverviewCanvas.java @@ -198,6 +198,7 @@ public class OverviewCanvas extends JComponent { updaterunning = false; lastMiniMe = miniMe; + alpha = 1f; timer.start(); } } @@ -226,8 +227,6 @@ 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) @@ -269,32 +268,32 @@ public class OverviewCanvas extends JComponent } else { - - if (lastMiniMe != miniMe && !resize) - { - g.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this); - g.setColor(TRANS_GREY); - g.fillRect(0, 0, getWidth(), getHeight()); - } - else if (veryLastMiniMe != null) + if (alpha != 0) // this is a timer triggered dissolve { Graphics2D g2d = (Graphics2D) g.create(); - g2d.setComposite(AlphaComposite.SrcOver.derive(alpha)); + // draw the original image g2d.drawImage(veryLastMiniMe, 0, 0, getWidth(), getHeight(), this); + // draw the new image on top with varying degrees of transparency g2d.setComposite(AlphaComposite.SrcOver.derive(1f - alpha)); g2d.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this); g2d.dispose(); } + else if (lastMiniMe != miniMe) + { + g.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this); + g.setColor(TRANS_GREY); + g.fillRect(0, 0, getWidth(), getHeight()); + } else { - // fall back if everything goes wrong somehow + // fall back to normal behaviour g.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this); } - resize = false; + } }