diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index 9ad3b2a..c5a8b00 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -288,19 +288,20 @@ return output.toString(); } - private void buildGeometryOutput(StringBuilder output, final mxCell cell) { - for (int i = 0; i < cell.getChildCount(); i++) { - mxCell child = (mxCell) cell.getChildAt(i); + private void buildGeometryOutput(StringBuilder output, final mxCell parent) { + for (int i = 0; i < parent.getChildCount(); i++) { + mxCell child = (mxCell) parent.getChildAt(i); if (!graph.getModel().isVertex(child)) { continue; } mxGraphView view = graph.getView(); - mxCellState state = view.getState(child); - String identifier = state.getLabel(); - int x = (int) state.getX(); - int y = (int) state.getY(); - int w = (int) state.getWidth(); - int h = (int) state.getHeight(); + mxCellState parentState = view.getState(parent); + mxCellState childState = view.getState(child); + String identifier = childState.getLabel(); + int x = (int) (childState.getX() - parentState.getX()); + int y = (int) (childState.getY() - parentState.getY()); + int w = (int) childState.getWidth(); + int h = (int) childState.getHeight(); // Skip if current cell is not graph node if (identifier == null || identifier.isEmpty()) {