model.setImplSpecificHelp(help);
panel.addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation();
TestbedTest currTest = model.getCurrTest();
if (currTest == null) {
return;
}
ZoomType zoom = notches < 0 ? ZoomType.ZOOM_IN : ZoomType.ZOOM_OUT;
currTest.getCamera().zoomToPoint(mouse, zoom);
}
});
panel.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent arg0) {
if (arg0.getButton() == screenDragButton) {
screenDragButtonDown = false;
} else if (model.getCodedKeys()[KeyEvent.VK_SHIFT] && !mouseJointButtonDown) {
controller.queueMouseUp(new Vec2(arg0.getX(), arg0.getY()), TestbedTest.BOMB_SPAWN_BUTTON);
} else {
if (arg0.getButton() == TestbedTest.MOUSE_JOINT_BUTTON) {
mouseJointButtonDown = false;
}
controller.queueMouseUp(new Vec2(arg0.getX(), arg0.getY()), arg0.getButton());
}
}
@Override
public void mousePressed(MouseEvent arg0) {
if (arg0.getButton() == screenDragButton) {
screenDragButtonDown = true;
oldDragMouse.set(arg0.getX(), arg0.getY());
return;
} else if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
controller.queueMouseDown(new Vec2(arg0.getX(), arg0.getY()),
TestbedTest.BOMB_SPAWN_BUTTON);
} else {
if (arg0.getButton() == TestbedTest.MOUSE_JOINT_BUTTON) {
mouseJointButtonDown = true;
}
controller.queueMouseDown(new Vec2(arg0.getX(), arg0.getY()), arg0.getButton());
}
}
});
panel.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent arg0) {
mouse.set(arg0.getX(), arg0.getY());
controller.queueMouseMove(new Vec2(mouse));
}
@Override
public void mouseDragged(MouseEvent arg0) {
mouse.set(arg0.getX(), arg0.getY());
if (screenDragButtonDown) {
TestbedTest currTest = model.getCurrTest();
if (currTest == null) {
return;
}
Vec2 diff = oldDragMouse.sub(mouse);
currTest.getCamera().moveWorld(diff);
oldDragMouse.set(mouse);
} else if (mouseJointButtonDown) {
controller.queueMouseDrag(new Vec2(mouse), TestbedTest.MOUSE_JOINT_BUTTON);
} else if (model.getCodedKeys()[KeyEvent.VK_SHIFT]) {
controller.queueMouseDrag(new Vec2(arg0.getX(), arg0.getY()),