use of org.talend.designer.core.ui.editor.cmd.ResizeNoteCommand in project tdi-studio-se by Talend.
the class NoteResizableEditPolicy method getResizeCommand.
@Override
protected Command getResizeCommand(ChangeBoundsRequest request) {
Object parent = getHost().getParent().getModel();
if (!(parent instanceof Process)) {
return null;
}
Note note = (Note) getHost().getModel();
if (note.isReadOnly()) {
return null;
}
TalendScalableFreeformRootEditPart rootEditPart = (TalendScalableFreeformRootEditPart) getHost().getRoot();
double scale = 1 / rootEditPart.getZoomManager().getZoom();
return new ResizeNoteCommand(note, new Dimension(note.getSize().width + request.getSizeDelta().getScaled(scale).width, note.getSize().height + request.getSizeDelta().getScaled(scale).height));
}
Aggregations