From bc948cc6fa075fe5bcd9aa29bf8e37552cf83cb7 Mon Sep 17 00:00:00 2001 From: hansonr Date: Wed, 31 Jul 2019 18:57:43 -0500 Subject: [PATCH] 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. --- src/jalview/gui/SeqCanvas.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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: -- 1.7.10.2