From 136b2682941bac853aadf1233377edd2325d2090 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Mon, 20 Nov 2006 18:08:28 +0000 Subject: [PATCH] check cursor is visible for hidden cols --- src/jalview/appletgui/SeqPanel.java | 22 ++++++++++++++++++++-- src/jalview/gui/SeqPanel.java | 23 +++++++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 8e70e35..feda697 100755 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -138,6 +138,24 @@ public class SeqPanel { seqCanvas.cursorX += dx; seqCanvas.cursorY += dy; + if (av.hasHiddenColumns && !av.colSel.isVisible(seqCanvas.cursorX)) + { + int original = seqCanvas.cursorX - dx; + int maxWidth = av.alignment.getWidth(); + + while(!av.colSel.isVisible(seqCanvas.cursorX) + && seqCanvas.cursorX0) + { + seqCanvas.cursorX += dx; + } + + if(seqCanvas.cursorX>=maxWidth + || !av.colSel.isVisible(seqCanvas.cursorX) ) + { + seqCanvas.cursorX = original; + } + } scrollToVisible(); } @@ -169,13 +187,13 @@ public class SeqPanel { ap.scrollUp(false); } - while (seqCanvas.cursorX < av.startRes) + while (seqCanvas.cursorX < av.colSel.adjustForHiddenColumns(av.startRes)) { if (!ap.scrollRight(false)) break; } - while (seqCanvas.cursorX > av.endRes) + while (seqCanvas.cursorX > av.colSel.adjustForHiddenColumns(av.endRes)) { if (!ap.scrollRight(true)) break; diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 4ea3a12..3349825 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -286,6 +286,25 @@ public class SeqPanel extends JPanel implements MouseListener, { seqCanvas.cursorX += dx; seqCanvas.cursorY += dy; + if (av.hasHiddenColumns && !av.colSel.isVisible(seqCanvas.cursorX)) + { + int original = seqCanvas.cursorX - dx; + int maxWidth = av.alignment.getWidth(); + + while(!av.colSel.isVisible(seqCanvas.cursorX) + && seqCanvas.cursorX0) + { + seqCanvas.cursorX += dx; + } + + if(seqCanvas.cursorX>=maxWidth + || !av.colSel.isVisible(seqCanvas.cursorX) ) + { + seqCanvas.cursorX = original; + } + } + scrollToVisible(); } @@ -319,12 +338,12 @@ public class SeqPanel extends JPanel implements MouseListener, } if (!av.wrapAlignment) { - while (seqCanvas.cursorX < av.startRes) + while (seqCanvas.cursorX < av.colSel.adjustForHiddenColumns(av.startRes)) { if (!ap.scrollRight(false)) break; } - while (seqCanvas.cursorX > av.endRes) + while (seqCanvas.cursorX > av.colSel.adjustForHiddenColumns(av.endRes)) { if (!ap.scrollRight(true)) break; -- 1.7.10.2