use of com.willwinder.ugs.nbp.designer.gui.KeyboardEntityEvent in project Universal-G-Code-Sender by winder.
the class ZoomControl method onEvent.
@Override
public void onEvent(EntityEvent entityEvent) {
if (entityEvent instanceof MouseEntityEvent) {
MouseEntityEvent mouseEntityEvent = (MouseEntityEvent) entityEvent;
isShiftPressed = mouseEntityEvent.isShiftPressed();
if (mouseEntityEvent.getType() == EventType.MOUSE_PRESSED) {
double zoomFactor = ZOOM_FACTOR;
if (isShiftPressed) {
zoomFactor = -zoomFactor;
}
controller.getDrawing().setScale(controller.getDrawing().getScale() + zoomFactor);
}
} else if (entityEvent instanceof KeyboardEntityEvent) {
KeyboardEntityEvent keyboardEntityEvent = (KeyboardEntityEvent) entityEvent;
if (keyboardEntityEvent.getKeyCode() == KeyEvent.VK_SHIFT) {
isShiftPressed = keyboardEntityEvent.getType() == EventType.KEY_PRESSED;
controller.getDrawing().repaint();
}
}
}
Aggregations