return;\r
\r
SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
+ if(res>sequence.getLength())\r
+ return;\r
+\r
Object obj = ResidueProperties.aa2Triplet.get( sequence.getCharAt(res)+"" ) ;\r
String aa = "";\r
if(obj!=null)\r
\r
ap.alignFrame.statusBar.setText(text.toString());\r
\r
- if(av.showSequenceFeatures)\r
+ // use aa to see if the mouse pointer is on a\r
+ if( av.showSequenceFeatures)\r
{\r
Vector features = sequence.getSequenceFeatures();\r
Enumeration e = features.elements();\r
public void doMouseDragged(MouseEvent evt) {\r
// If we're dragging we're editing\r
\r
+ if(lastres==-1)\r
+ return;\r
+\r
int x = evt.getX();\r
\r
int res = x/av.getCharWidth() + av.getStartRes();\r
int seq = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
oldSeq = seq;\r
\r
+ SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);\r
+ if(res>sequence.getLength())\r
+ return;\r
+\r
stretchGroup = av.getRubberbandGroup();\r
\r
if(stretchGroup == null)\r
{\r
- stretchGroup = av.alignment.findGroup( (Sequence) av.getAlignment().\r
- getSequenceAt(seq));\r
+ stretchGroup = av.alignment.findGroup( sequence );\r
av.setRubberbandGroup( stretchGroup );\r
}\r
\r
- else if(!stretchGroup.sequences.contains((Sequence)av.getAlignment().getSequenceAt(seq))\r
+ else if(!stretchGroup.sequences.contains(sequence)\r
|| stretchGroup.getStartRes()>res\r
|| stretchGroup.getEndRes()<res)\r
{\r
stretchGroup = null;\r
\r
- SequenceGroup[] allGroups = av.alignment.findAllGroups( (Sequence) av.\r
- getAlignment().\r
- getSequenceAt(seq));\r
+ SequenceGroup[] allGroups = av.alignment.findAllGroups( sequence );\r
\r
if (allGroups != null)\r
for (int i = 0; i < allGroups.length; i++)\r
SequenceGroup sg = new SequenceGroup();\r
sg.setStartRes(res);\r
sg.setEndRes(res);\r
- sg.addSequence( (Sequence)av.getAlignment().getSequenceAt(seq) );\r
+ sg.addSequence( sequence );\r
av.setRubberbandGroup( sg );\r
stretchGroup = sg;\r
\r
\r
public void doMouseReleasedDefineMode(MouseEvent evt)\r
{\r
+ if(stretchGroup==null)\r
+ return;\r
\r
if(stretchGroup.cs instanceof ClustalxColourScheme)\r
{\r
int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
int y = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
\r
+ if(stretchGroup==null)\r
+ return;\r
\r
if(stretchGroup.getEndRes()==res)\r
// Edit end res position of selected group\r