From 8030eb1b0676c7ffe57f90d8131525ab7ff4b243 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 10 Feb 2005 13:23:09 +0000 Subject: [PATCH] check that mouse is over sequence if unaligned --- src/jalview/gui/SeqPanel.java | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 83dceef..35c5aef 100755 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -170,6 +170,9 @@ public class SeqPanel extends JPanel return; SequenceI sequence = av.getAlignment().getSequenceAt(seq); + if(res>sequence.getLength()) + return; + Object obj = ResidueProperties.aa2Triplet.get( sequence.getCharAt(res)+"" ) ; String aa = ""; if(obj!=null) @@ -181,7 +184,8 @@ public class SeqPanel extends JPanel ap.alignFrame.statusBar.setText(text.toString()); - if(av.showSequenceFeatures) + // use aa to see if the mouse pointer is on a + if( av.showSequenceFeatures) { Vector features = sequence.getSequenceFeatures(); Enumeration e = features.elements(); @@ -213,6 +217,9 @@ public class SeqPanel extends JPanel public void doMouseDragged(MouseEvent evt) { // If we're dragging we're editing + if(lastres==-1) + return; + int x = evt.getX(); int res = x/av.getCharWidth() + av.getStartRes(); @@ -361,24 +368,25 @@ public class SeqPanel extends JPanel int seq = evt.getY()/av.getCharHeight() + av.getStartSeq(); oldSeq = seq; + SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq); + if(res>sequence.getLength()) + return; + stretchGroup = av.getRubberbandGroup(); if(stretchGroup == null) { - stretchGroup = av.alignment.findGroup( (Sequence) av.getAlignment(). - getSequenceAt(seq)); + stretchGroup = av.alignment.findGroup( sequence ); av.setRubberbandGroup( stretchGroup ); } - else if(!stretchGroup.sequences.contains((Sequence)av.getAlignment().getSequenceAt(seq)) + else if(!stretchGroup.sequences.contains(sequence) || stretchGroup.getStartRes()>res || stretchGroup.getEndRes()