private void execUndoInformation(boolean undo) { UndoInformation undoInfo = undoStack.get(undo); if (undoInfo != null) { setRectangle(getRectangle().add(undoInfo.getDiffRectangle(getGridSize(), undo))); Stickables.applyChanges(undoInfo.getStickableMoves(undo), null); // setAdditionalAttributes(undoInfo.getAdditionalAttributes(undo)); //Issue 217: of all // OldGridElements only the Relation uses additional attributes and in that case they must not // be set because of zooming errors (see Issue 217) } }
private void moveStickables( StickableMap stickables, boolean undoable, Rectangle oldRect, StickingPolygon stickingPolygonBeforeLocationChange, String oldAddAttr) { Map<Stickable, List<PointChange>> stickableChanges = Stickables.moveStickPointsBasedOnPolygonChanges( stickingPolygonBeforeLocationChange, generateStickingBorder(), stickables, getGridSize()); if (undoable) { undoStack.add( new UndoInformation( getRectangle(), oldRect, stickableChanges, getGridSize(), oldAddAttr, getAdditionalAttributes())); } }
@Override public void mergeUndoDrag() { UndoInformation undoInfoA = undoStack.remove(); UndoInformation undoInfoB = undoStack.remove(); undoStack.add(undoInfoA.merge(undoInfoB)); }