From: amwaterhouse Date: Mon, 20 Nov 2006 18:08:28 +0000 (+0000) Subject: check cursor is visible for hidden cols X-Git-Tag: Release_2_2~101 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=136b2682941bac853aadf1233377edd2325d2090;p=jalview.git check cursor is visible for hidden cols --- 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;