import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.ContactListI;
+import jalview.datamodel.ContactRange;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SequenceI;
import jalview.gui.JalviewColourChooser.ColourChooserListener;
if (graphStretch != -1)
{
+
if (aa[graphStretch].graph == AlignmentAnnotation.CUSTOMRENDERER)
{
- int currentX = getColumnForXPos(evt.getX());
- ContactListI forCurrentX = av.getContactList(aa[graphStretch],
- currentX);
- if (forCurrentX != null)
+ if (evt.isAltDown() || evt.isAltGraphDown())
+ {
+ dragMode = DragMode.MatrixSelect;
+ firstDragX = mouseDragLastX;
+ firstDragY = mouseDragLastY;
+ }
+ else
{
- ContactGeometry cXcgeom = new ContactGeometry(forCurrentX,
- aa[graphStretch].graphHeight);
- ContactGeometry.contactInterval cXci = cXcgeom.mapFor(yOffset,
- yOffset);
- int fr, to;
- fr = Math.min(cXci.cStart, cXci.cEnd);
- to = Math.max(cXci.cStart, cXci.cEnd);
- for (int c = fr; c <= to; c++)
+ int currentX = getColumnForXPos(evt.getX());
+ ContactListI forCurrentX = av.getContactList(aa[graphStretch],
+ currentX);
+ if (forCurrentX != null)
{
- av.getColumnSelection().addElement(c);
+ ContactGeometry cXcgeom = new ContactGeometry(forCurrentX,
+ aa[graphStretch].graphHeight);
+ ContactGeometry.contactInterval cXci = cXcgeom.mapFor(yOffset,
+ yOffset);
+ int fr, to;
+ fr = Math.min(cXci.cStart, cXci.cEnd);
+ to = Math.max(cXci.cStart, cXci.cEnd);
+ for (int c = fr; c <= to; c++)
+ {
+ av.getColumnSelection().addElement(c);
+ }
+ av.getColumnSelection().addElement(currentX);
}
- av.getColumnSelection().addElement(currentX);
}
}
}
graphStretch = -1;
mouseDragLastX = -1;
mouseDragLastY = -1;
+ firstDragX = -1;
+ firstDragY = -1;
mouseDragging = false;
if (dragMode == DragMode.Resize)
{
/*
* TODO draw a rubber band for range
*/
+ mouseDragLastX = x;
+ mouseDragLastY = y;
+ ap.paintAlignment(false, false);
}
else
{
* get geometry of drag
*/
int fromY = Math.min(firstDragY, evt.getY());
- int deltaY = Math.abs(firstDragY - evt.getY());
int toY = Math.max(firstDragY, evt.getY());
+ int deltaY = toY - fromY;
int[] rowIndex = getRowIndexAndOffset(fromY,
av.getAlignment().getAlignmentAnnotation());
+ int[] toRowIndex = getRowIndexAndOffset(toY,
+ av.getAlignment().getAlignmentAnnotation());
+
+ if (rowIndex == null || toRowIndex == null)
+ {
+ System.out.println("Drag out of range. needs to be clipped");
+
+ }
+ if (rowIndex[0] != toRowIndex[0])
+ {
+ System.out.println("Drag went to another row. needs to be clipped");
+ }
// rectangular selection on matrix style annotation
AlignmentAnnotation cma = av.getAlignment()
{
fadedImage = oldFaded;
}
+ if (dragMode == DragMode.MatrixSelect)
+ {
+ g.setColor(Color.yellow);
+ g.drawRect(Math.min(firstDragX, mouseDragLastX),
+ Math.min(firstDragY, mouseDragLastY),
+ Math.max(firstDragX, mouseDragLastX)
+ - Math.min(firstDragX, mouseDragLastX),
+ Math.max(firstDragY, mouseDragLastY)
+ - Math.min(firstDragY, mouseDragLastY));
+
+ }
}
@Override