private Point[] axisEndPoints;
// fields for 'select rectangle' (JAL-1124)
- // int rectx1;
- // int recty1;
- // int rectx2;
- // int recty2;
+ int rectx1;
+ int recty1;
+ int rectx2;
+ int recty2;
AlignmentViewport av;
}
}
// //Now the rectangle
- // if (rectx2 != -1 && recty2 != -1) {
- // g.setColor(Color.white);
- //
- // g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);
- // }
+ if (rectx2 != -1 && recty2 != -1) {
+ g.setColor(Color.white);
+
+ g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);
+ }
}
/**
// Cache.warn("DEBUG: Rectangle selection");
// todo not yet enabled as rectx2, recty2 are always -1
// need to set them in mouseDragged; JAL-1124
- // if ((rectx2 != -1) && (recty2 != -1))
- // {
- // rectSelect(rectx1, recty1, rectx2, recty2);
- // }
+ if ((rectx2 != -1) && (recty2 != -1))
+ {
+ rectSelect(rectx1, recty1, rectx2, recty2);
+ }
}
repaint();
mouseX = x;
mouseY = y;
- // rectx1 = x;
- // recty1 = y;
- // rectx2 = -1;
- // recty2 = -1;
+ rectx1 = x;
+ recty1 = y;
+ rectx2 = -1;
+ recty2 = -1;
SequenceI found = findSequenceAtPoint(x, y);
// Check if this is a rectangle drawing drag
if ((evt.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0)
{
- // rectx2 = evt.getX();
- // recty2 = evt.getY();
+ rectx2 = evt.getX();
+ recty2 = evt.getY();
}
else
{
{
float[] centre = getCentre();
+ //&!
+ //System.out.println(String.format("rectangle: %d, %d, %d, %d, width: %d, height: %d", x1, y1, x2, y2, getWidth(), getHeight()));
for (int i = 0; i < npoint; i++)
{
SequencePoint sp = sequencePoints.get(i);
int tmp1 = (int) (((sp.coord.x - centre[0]) * getScaleFactor())
+ * (getWidth() / 2.0)
+ (getWidth() / 2.0));
+ float pre1 = ((sp.coord.x - centre[0]) * getScaleFactor());
int tmp2 = (int) (((sp.coord.y - centre[1]) * getScaleFactor())
+ * (getHeight() / 2.0)
+ (getHeight() / 2.0));
+ float pre2 = ((sp.coord.y - centre[1]) * getScaleFactor());
+ //&!
+ //System.out.println(String.format("%s -- pre1: %3.2f, tmp1: %d, pre2: %3.2f, tmp2: %d", sp.toString(), pre1, tmp1, pre2, tmp2));
if ((tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2))
{
if (av != null)
{
SequenceI sequence = sp.getSequence();
+ if (av.getSelectionGroup() == null)
+ {
+ SequenceGroup sg = new SequenceGroup();
+ sg.setEndRes(av.getAlignment().getWidth() - 1);
+ av.setSelectionGroup(sg);
+ }
if (!av.getSelectionGroup().getSequences(null).contains(sequence))
{
av.getSelectionGroup().addSequence(sequence, true);