// set the default as current
manager.setActiveWidget(rotateWidget);
// add triggers to change which widget is active
manager.getLogicalLayer().registerTrigger(
new InputTrigger(new KeyHeldCondition(Key.LSHIFT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
manager.setActiveWidget(scaleWidget);
}
}));
manager.getLogicalLayer().registerTrigger(
new InputTrigger(new KeyReleasedCondition(Key.LSHIFT), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
manager.setActiveWidget(rotateWidget);
}
}));
manager.getLogicalLayer().registerTrigger(
new InputTrigger(new KeyHeldCondition(Key.LCONTROL), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
manager.setActiveWidget(moveWidget);
}
}));
manager.getLogicalLayer().registerTrigger(
new InputTrigger(new KeyReleasedCondition(Key.LCONTROL), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
manager.setActiveWidget(rotateWidget);
}
}));
// add toggle for matrix mode on widgets.
manager.getLogicalLayer().registerTrigger(new InputTrigger(new KeyPressedCondition(Key.R), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
rotateWidget.setInteractMatrix(rotateWidget.getInteractMatrix() == InteractMatrix.World ? InteractMatrix.Local
: InteractMatrix.World);
rotateWidget.targetDataUpdated(manager);
moveWidget.setInteractMatrix(rotateWidget.getInteractMatrix());
moveWidget.targetDataUpdated(manager);
}
}));
// add triggers to change which widget is active
manager.getLogicalLayer().registerTrigger(
new InputTrigger(new KeyPressedCondition(Key.SPACE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
manager.getSpatialTarget().setRotation(Matrix3.IDENTITY);
manager.fireTargetDataUpdated();
}