*/
int fromY = Math.min(firstDragY, evt.getY());
int toY = Math.max(firstDragY, evt.getY());
+ int fromX = Math.min(firstDragX, evt.getX());
+ int toX = Math.max(firstDragX, evt.getX());
+
int deltaY = toY - fromY;
+ int deltaX = toX - fromX;
int[] rowIndex = getRowIndexAndOffset(fromY,
av.getAlignment().getAlignmentAnnotation());
AlignmentAnnotation cma = av.getAlignment()
.getAlignmentAnnotation()[rowIndex[0]];
- int fromXp = Math.min(firstDragX, evt.getX());
- int toXp = Math.max(firstDragX, evt.getX());
- int lastX = getColumnForXPos(fromXp);
- int currentX = getColumnForXPos(toXp);
- ContactListI forLastX = av.getContactList(cma, lastX);
- ContactListI forCurrentX = av.getContactList(cma, currentX);
- if (forLastX != null && forCurrentX != null)
+ int lastX = getColumnForXPos(fromX);
+ int currentX = getColumnForXPos(toX);
+ int fromXc = Math.min(lastX, currentX);
+ int toXc = Math.max(lastX, currentX);
+ ContactListI forFromX = av.getContactList(cma, fromXc);
+ ContactListI forToX = av.getContactList(cma, toXc);
+
+ if (forFromX != null && forToX != null)
{
- ContactGeometry lastXcgeom = new ContactGeometry(forLastX,
+ ContactGeometry lastXcgeom = new ContactGeometry(forFromX,
cma.graphHeight);
- ContactGeometry.contactInterval lastXci = lastXcgeom.mapFor(
- rowIndex[1],
- rowIndex[1] + ((fromY == firstDragY) ? -deltaY : deltaY));
- ContactGeometry cXcgeom = new ContactGeometry(forCurrentX,
+ ContactGeometry.contactInterval lastXci = lastXcgeom
+ .mapFor(rowIndex[1], rowIndex[1] + deltaY);
+ ContactGeometry cXcgeom = new ContactGeometry(forToX,
cma.graphHeight);
ContactGeometry.contactInterval cXci = cXcgeom.mapFor(rowIndex[1],
rowIndex[1] + deltaY);