Search in sources :

Example 1 with RotateAction

use of com.willwinder.ugs.nbp.designer.actions.RotateAction in project Universal-G-Code-Sender by winder.

the class RotationControl method addUndoAction.

private void addUndoAction(Point2D center, double rotation, Entity target) {
    UndoManager undoManager = CentralLookup.getDefault().lookup(UndoManager.class);
    if (undoManager != null) {
        List<Entity> entityList = new ArrayList<>();
        if (target instanceof SelectionManager) {
            entityList.addAll(((SelectionManager) target).getSelection());
        } else {
            entityList.add(target);
        }
        undoManager.addAction(new RotateAction(entityList, center, rotation));
    }
}
Also used : Entity(com.willwinder.ugs.nbp.designer.entities.Entity) SelectionManager(com.willwinder.ugs.nbp.designer.entities.selection.SelectionManager) UndoManager(com.willwinder.ugs.nbp.designer.actions.UndoManager) RotateAction(com.willwinder.ugs.nbp.designer.actions.RotateAction) ArrayList(java.util.ArrayList)

Aggregations

RotateAction (com.willwinder.ugs.nbp.designer.actions.RotateAction)1 UndoManager (com.willwinder.ugs.nbp.designer.actions.UndoManager)1 Entity (com.willwinder.ugs.nbp.designer.entities.Entity)1 SelectionManager (com.willwinder.ugs.nbp.designer.entities.selection.SelectionManager)1 ArrayList (java.util.ArrayList)1