X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FRotatableCanvas.java;h=b4af354b239dafe28f1b5a60f75e17df481a8374;hb=31a5f9724e7ba5c8f67a6db9a0c0f2356cd81b9d;hp=90688d0767ca84af4f8dd9434e8ad5403ea54168;hpb=1ecf6419aba86993b3c223bf5ec0fa79427baf85;p=jalview.git diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 90688d0..b4af354 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -284,23 +284,24 @@ public class RotatableCanvas extends JPanel implements MouseListener, int x = (int)((float)(sp.coord[0] - centre[0])*scale) + halfwidth; int y = (int)((float)(sp.coord[1] - centre[1])*scale) + halfheight; float z = sp.coord[1] - centre[2]; - if (sp.sequence instanceof DrawableSequence) { - if (((DrawableSequence)sp.sequence).color == Color.black) { + + + + + if (sp.sequence.getColor() == Color.black) g.setColor(Color.white); - } else { - g.setColor(((DrawableSequence)sp.sequence).color); - } - } else { - g.setColor(Color.red); - } - if (av != null) { - if (av.getSelection().contains(((SequencePoint)points.elementAt(i)).sequence)) { + else + g.setColor(sp.sequence.getColor()); + + + if (av.getSelectionGroup() != null) + { + if (av.getSelectionGroup().sequences.contains(((SequencePoint)points.elementAt(i)).sequence)) g.setColor(Color.gray); - } } - if (z < 0) { + if (z < 0) g.setColor(g.getColor().darker()); - } + g.fillRect(x-3,y-3,6,6); g.setColor(Color.red); @@ -379,16 +380,20 @@ public class RotatableCanvas extends JPanel implements MouseListener, SequenceI found = findPoint(x,y); - if (found != null) { - if (av != null) { - - if (av.getSelection().contains(found)) { - av.getSelection().removeElement(found); - } else { - av.getSelection().addElement(found); - } + if (found != null) + { + if (av.getSelectionGroup() != null) + { + av.getSelectionGroup().addOrRemove(found); PaintRefresher.Refresh(this); } + else + { + av.setSelectionGroup(new SequenceGroup()); + av.getSelectionGroup().addOrRemove(found); + av.getSelectionGroup().setEndRes(av.alignment.getWidth()); + + } } repaint(); } @@ -454,9 +459,10 @@ public class RotatableCanvas extends JPanel implements MouseListener, if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2) { if (av != null) { - if (!av.getSelection().contains(sp.sequence)) { + if (!av.getSelectionGroup().sequences.contains(sp.sequence)) + { changedSel = true; - av.getSelection().addElement(sp.sequence); + av.getSelectionGroup().addSequence(sp.sequence); } } }