protected AlignViewport av;\r
AlignmentPanel ap;\r
\r
+ boolean stretchingGroup = false;\r
+\r
public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
{\r
this.av = av;\r
public void doMousePressed(MouseEvent evt) {\r
int x = evt.getX();\r
int res = x/av.getCharWidth() + av.getStartRes();\r
+ SequenceGroup sg = null;\r
\r
- if (! av.getColumnSelection().contains(res))\r
- av.getColumnSelection().addElement(res);\r
+ if (av.getColumnSelection().contains(res))\r
+ av.getColumnSelection().removeElement(res);\r
else\r
- return;\r
+ {\r
+ av.getColumnSelection().addElement(res);\r
\r
- SequenceGroup sg = new SequenceGroup();\r
- for(int i=0; i<av.alignment.getSequences().size(); i++)\r
+ sg = new SequenceGroup();\r
+ for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
sg.addSequence(av.alignment.getSequenceAt(i));\r
\r
- sg.setStartRes(res);\r
- sg.setEndRes(res);\r
+ sg.setStartRes(res);\r
+ sg.setEndRes(res);\r
+ }\r
av.setRubberbandGroup(sg);\r
ap.RefreshPanels();\r
}\r
\r
public void doMouseReleased(MouseEvent evt)\r
{\r
+ if(!stretchingGroup)\r
+ return;\r
+\r
int x = evt.getX();\r
int res = x/av.getCharWidth() + av.getStartRes();\r
\r
else if(res<sg.getStartRes())\r
sg.setStartRes(res);\r
\r
+ stretchingGroup = false;\r
ap.RefreshPanels();\r
}\r
\r
int res = x/av.getCharWidth() + av.getStartRes();\r
\r
SequenceGroup sg = av.getRubberbandGroup();\r
-\r
- if(res>sg.getStartRes())\r
- sg.setEndRes(res);\r
- else if(res<sg.getStartRes())\r
- sg.setStartRes(res);\r
-\r
-\r
- ap.RefreshPanels();\r
+ if(sg!=null)\r
+ {\r
+ stretchingGroup = true;\r
+ if (res > sg.getStartRes())\r
+ sg.setEndRes(res);\r
+ else if (res < sg.getStartRes())\r
+ sg.setStartRes(res);\r
+\r
+ ap.RefreshPanels();\r
+ }\r
\r
}\r
}\r