Skip to content

Commit

Permalink
[#505] Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
prmr committed Jul 11, 2023
1 parent 2976a1b commit 7eefb78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/org/jetuml/diagram/builder/ClassDiagramBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.jetuml.diagram.nodes.PackageNode;
import org.jetuml.diagram.nodes.TypeNode;
import org.jetuml.geom.Point;
import org.jetuml.geom.Rectangle;

/**
* A builder for class diagrams.
Expand Down Expand Up @@ -305,6 +306,8 @@ public DiagramOperation createUnlinkFromPackageOperation(List<Node> pNodes)
Node parent = findSharedParent(pNodes).get();
// CSOFF:
Node outerParent = parent.hasParent() ? parent.getParent() : null; //CSON:
Rectangle parentBound = packageNodeRenderer().getBounds(parent);

if( outerParent == null )
{
// The parent of the nodes in pNodes does not have parent,
Expand All @@ -316,6 +319,8 @@ public DiagramOperation createUnlinkFromPackageOperation(List<Node> pNodes)
aDiagramRenderer.diagram().addRootNode(pNode);
parent.removeChild(pNode);
}
parent.translate( parentBound.getX()-parent.position().getX(),
parentBound.getY()-parent.position().getY() );
},
()->
{
Expand All @@ -337,6 +342,8 @@ public DiagramOperation createUnlinkFromPackageOperation(List<Node> pNodes)
parent.removeChild(pNode);
outerParent.addChild(pNode);
}
parent.translate( parentBound.getX()-parent.position().getX(),
parentBound.getY()-parent.position().getY() );
},
()->
{
Expand Down
2 changes: 1 addition & 1 deletion src/org/jetuml/diagram/builder/DiagramBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ private Runnable createDetachOperation(Node pNode)
};
}

private PackageNodeRenderer packageNodeRenderer()
protected PackageNodeRenderer packageNodeRenderer()
{
return (PackageNodeRenderer)aDiagramRenderer.rendererFor(PackageNode.class);
}
Expand Down

0 comments on commit 7eefb78

Please sign in to comment.