public void redo() throws CannotRedoException { super.redo(); JEnvironment env = viewer.getEnvironment(); env.addClip(target.getBounds()); for (int i = 0; i < segments.size(); i++) { segments.get(i).transform(af); } target.updatePath(); env.addClip(target.getBounds()); }
public void undo() throws CannotUndoException { super.undo(); JEnvironment env = viewer.getEnvironment(); AffineTransform inv = null; try { inv = af.createInverse(); } catch (NoninvertibleTransformException e) { return; } env.addClip(target.getBounds()); for (int i = 0; i < segments.size(); i++) { segments.get(i).transform(inv); } target.updatePath(); env.addClip(target.getBounds()); }