@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 (keyCode == KeyEvent.VK_DOWN)
+ {
+ if (shiftDown)
+ {
+ rotate(0f, 1f);
+ }
+ else
+ {
+ zoom(0.9f);
+ }
+ }
+ else if (shiftDown && keyCode == KeyEvent.VK_LEFT)
+ {
+ rotate(1f, 0f);
}
- else if (evt.getKeyCode() == KeyEvent.VK_DOWN)
+ else if (shiftDown && keyCode == KeyEvent.VK_RIGHT)
{
- zoom(0.9f);
+ rotate(-1f, 0f);
}
else if (evt.getKeyChar() == 's')
{
public void keyPressed(KeyEvent evt)
{
int keyCode = evt.getKeyCode();
+ boolean shiftDown = evt.isShiftDown();
if (keyCode == KeyEvent.VK_UP)
{
- zoom(ZOOM_IN);
+ if (shiftDown)
+ {
+ rotate(0f, -1f);
+ }
+ else
+ {
+ zoom(ZOOM_IN);
+ }
}
else if (keyCode == KeyEvent.VK_DOWN)
{
- zoom(ZOOM_OUT);
+ if (shiftDown)
+ {
+ rotate(0f, 1f);
+ }
+ else
+ {
+ zoom(ZOOM_OUT);
+ }
+ }
+ 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')
{