for (int i = 0; i < 3; i++)
{
g.drawLine(getSize().width / 2, getSize().height / 2,
- (int) (axisEndPoints[i].x * scale * max[0] + getSize().width / 2),
- (int) (axisEndPoints[i].y * scale * max[1] + getSize().height / 2));
+ (int) (axisEndPoints[i].x * scale * max[0]
+ + getSize().width / 2),
+ (int) (axisEndPoints[i].y * scale * max[1]
+ + getSize().height / 2));
}
}
sequenceColour == Color.black ? Color.white : sequenceColour);
if (av.getSelectionGroup() != null)
{
- if (av.getSelectionGroup().getSequences(null)
- .contains(sequence))
+ if (av.getSelectionGroup().getSequences(null).contains(sequence))
{
g.setColor(Color.gray);
}
@Override
public void keyPressed(KeyEvent evt)
{
- if (evt.getKeyCode() == KeyEvent.VK_UP)
+ boolean shiftDown = evt.isShiftDown();
+ int keyCode = evt.getKeyCode();
+ if (keyCode == KeyEvent.VK_UP)
{
- zoom(1.1f);
+ if (shiftDown)
+ {
+ rotate(0f, -1f);
+ }
+ else
+ {
+ zoom(1.1f);
+ }
}
- else if (evt.getKeyCode() == KeyEvent.VK_DOWN)
+ else if (keyCode == KeyEvent.VK_DOWN)
{
- zoom(0.9f);
+ if (shiftDown)
+ {
+ rotate(0f, 1f);
+ }
+ else
+ {
+ zoom(0.9f);
+ }
+ }
+ else if (shiftDown && keyCode == KeyEvent.VK_LEFT)
+ {
+ rotate(1f, 0f);
+ }
+ else if (shiftDown && keyCode == KeyEvent.VK_RIGHT)
+ {
+ rotate(-1f, 0f);
}
else if (evt.getKeyChar() == 's')
{
{
if (av != null)
{
- if (!av.getSelectionGroup().getSequences(null)
- .contains(sequence))
+ if (!av.getSelectionGroup().getSequences(null).contains(sequence))
{
av.getSelectionGroup().addSequence(sequence, true);
}
{
SequencePoint sp = points.get(i);
- int px = (int) ((sp.coord.x - centre.x) * scale)
- + halfwidth;
- int py = (int) ((sp.coord.y - centre.y) * scale)
- + halfheight;
+ int px = (int) ((sp.coord.x - centre.x) * scale) + halfwidth;
+ int py = (int) ((sp.coord.y - centre.y) * scale) + halfheight;
if (Math.abs(px - x) < 3 && Math.abs(py - y) < 3)
{
{
return;
}
-
+
/*
* get the identity transformation...
*/
RotatableMatrix rotmat = new RotatableMatrix();
-
+
/*
* rotate around the X axis for change in Y
* (mouse movement up/down); note we are equating a
{
rotmat.rotate(y, Axis.X);
}
-
+
/*
* rotate around the Y axis for change in X
* (mouse movement left/right)
{
rotmat.rotate(x, Axis.Y);
}
-
+
/*
* apply the composite transformation to sequence points
*/
// Now translate back again
sp.translate(centre.x, centre.y, centre.z);
}
-
+
/*
* rotate the x/y/z axis positions
*/