From: Jim Procter Date: Wed, 8 Jun 2022 12:10:42 +0000 (+0100) Subject: JAL-4024 only render partially when new view overlaps with last rendered annotation... X-Git-Tag: Release_2_11_2_6~61^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fpatch%2FJAL-4024_jumpScrollHang;p=jalview.git JAL-4024 only render partially when new view overlaps with last rendered annotation panel view --- diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 756e544..e9ef19c 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1124,19 +1124,21 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, Graphics2D gg = (Graphics2D) image.getGraphics(); - gg.copyArea(0, 0, imgWidth, getHeight(), - -horizontal * av.getCharWidth(), 0); - - if (horizontal > 0) // scrollbar pulled right, image to the left - { - transX = (er - sr - horizontal) * av.getCharWidth(); - sr = er - horizontal; - } - else if (horizontal < 0) - { - er = sr - horizontal; + if (imgWidth>Math.abs(horizontal*av.getCharWidth())) { + //scroll is less than imgWidth away so can re-use buffered graphics + gg.copyArea(0, 0, imgWidth, getHeight(), + -horizontal * av.getCharWidth(), 0); + + if (horizontal > 0) // scrollbar pulled right, image to the left + { + transX = (er - sr - horizontal) * av.getCharWidth(); + sr = er - horizontal; + } + else if (horizontal < 0) + { + er = sr - horizontal; + } } - gg.translate(transX, 0); drawComponent(gg, sr, er);