fixed an issue where the spacing was decided by the first element and not the (vertically) largest
This commit is contained in:
parent
521ee92c0a
commit
d238c521ea
|
@ -78,11 +78,15 @@ public class AutoPositionAction extends AbstractAction {
|
||||||
*/
|
*/
|
||||||
private void positionRelations(ArrayList<Relation> orderList) {
|
private void positionRelations(ArrayList<Relation> orderList) {
|
||||||
if (orderList.isEmpty()) return;
|
if (orderList.isEmpty()) return;
|
||||||
|
AtomicInteger vertSpace = new AtomicInteger(0);
|
||||||
int vertSpace = (int) orderList.get(0).getViewModel().getBounds(diagramPanel.getGraphics2D()).getHeight() + PADDING;
|
orderList.forEach(r -> {
|
||||||
|
int height = (int) r.getViewModel().getBounds(diagramPanel.getGraphics2D()).getHeight();
|
||||||
|
vertSpace.set(Math.max(vertSpace.get(), height));
|
||||||
|
});
|
||||||
|
vertSpace.addAndGet(PADDING);
|
||||||
AtomicInteger vertPos = new AtomicInteger(MARGIN);
|
AtomicInteger vertPos = new AtomicInteger(MARGIN);
|
||||||
orderList.forEach(r -> {
|
orderList.forEach(r -> {
|
||||||
r.setPosition(new Point(MARGIN, vertPos.getAndAdd(vertSpace)));
|
r.setPosition(new Point(MARGIN, vertPos.getAndAdd(vertSpace.get())));
|
||||||
});
|
});
|
||||||
|
|
||||||
diagramPanel.centerModel();
|
diagramPanel.centerModel();
|
||||||
|
|
Loading…
Reference in New Issue