From: kiramt Date: Wed, 22 Nov 2017 16:08:59 +0000 (+0000) Subject: JAL-2842 JAL-2759 change to SeqPanel moveCursor X-Git-Tag: Release_2_10_4~55^2~1^2~53 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3cc68e83677a61f5e3a12108018df0e87d774f54;p=jalview.git JAL-2842 JAL-2759 change to SeqPanel moveCursor --- diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index e11af48..8b80ffd 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -363,10 +363,25 @@ public class SeqPanel extends JPanel int original = seqCanvas.cursorX - dx; int maxWidth = av.getAlignment().getWidth(); - while (!hidden.isVisible(seqCanvas.cursorX) - && seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0) + if (!hidden.isVisible(seqCanvas.cursorX)) { - seqCanvas.cursorX += dx; + int visx = hidden.findColumnPosition(seqCanvas.cursorX - dx); + int[] region = hidden.getRegionWithEdgeAtRes(visx); + + if (region != null) // just in case + { + if (dx == 1) + { + // moving right + seqCanvas.cursorX = region[1] + 1; + } + else if (dx == -1) + { + // moving left + seqCanvas.cursorX = region[0] - 1; + } + } + seqCanvas.cursorX = (seqCanvas.cursorX < 0) ? 0 : seqCanvas.cursorX; } if (seqCanvas.cursorX >= maxWidth