From: hansonr Date: Wed, 31 Jul 2019 23:57:43 +0000 (-0500) Subject: JAL-3383 JAL-3253-applet fixes issue with X+Y scroll of Overview X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bc948cc6fa075fe5bcd9aa29bf8e37552cf83cb7;p=jalview.git JAL-3383 JAL-3253-applet fixes issue with X+Y scroll of Overview trashing vertical alignment. Uncertain why, but it is working OK in Java, where there was only a transient, occasional vertical offset issue. --- diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index 2d83e9e..536bfef 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -1690,6 +1690,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI // Make sure we're not trying to draw a panel // larger than the visible window int scrollX = 0; + int scrollY = 0; switch (eventName) { case SequenceGroup.SEQ_GROUP_CHANGED: @@ -1717,8 +1718,21 @@ public class SeqCanvas extends JPanel implements ViewportListenerI case ViewportRanges.STARTRESANDSEQ: scrollX = ((int[]) evt.getNewValue())[0] - ((int[]) evt.getOldValue())[0]; + scrollY = ((int[]) evt.getNewValue())[1] + - ((int[]) evt.getOldValue())[1]; + + // System.out.println("SC dx dy " + scrollX + " " + scrollY); + + if (scrollX != 0 && scrollY != 0) + { + // all sorts of problems in JavaScript if this is commented out. + repaint(); + return; + + } break; } + ViewportRanges vpRanges = av.getRanges(); int range = vpRanges.getEndRes() - vpRanges.getStartRes() + 1; scrollX = Math.max(Math.min(scrollX, range), -range); @@ -1729,7 +1743,7 @@ public class SeqCanvas extends JPanel implements ViewportListenerI } else { - fastPaint(scrollX, 0); + fastPaint(scrollX, scrollY); } // BH 2019.07.27 was: