diff --git a/capellambse_context_diagrams/collectors/default.py b/capellambse_context_diagrams/collectors/default.py index 68609653..32a47771 100644 --- a/capellambse_context_diagrams/collectors/default.py +++ b/capellambse_context_diagrams/collectors/default.py @@ -60,14 +60,14 @@ def collector( "output": -makers.NEIGHBOR_VMARGIN, } child_boxes: list[_elkjs.ELKInputChild] = [] - for i, local_ports, side in port_context_collector(ex_datas, ports): - _, label_height = helpers.get_text_extent(i.name) + for child, local_ports, side in port_context_collector(ex_datas, ports): + _, label_height = helpers.get_text_extent(child.name) height = max( label_height + 2 * makers.LABEL_VPAD, makers.PORT_PADDING + (makers.PORT_SIZE + makers.PORT_PADDING) * len(local_ports), ) - if box := global_boxes.get(i.uuid): # type: ignore[assignment] + if box := global_boxes.get(child.uuid): # type: ignore[assignment] if box is centerbox: continue box.setdefault("ports", []).extend( @@ -76,23 +76,25 @@ def collector( box["height"] += height else: box = makers.make_box( - i, height=height, no_symbol=diagram.display_symbols_as_boxes + child, + height=height, + no_symbol=diagram.display_symbols_as_boxes, ) box["ports"] = [makers.make_port(j.uuid) for j in local_ports] - if i.parent.uuid == centerbox["id"]: + if child.parent.uuid == centerbox["id"]: child_boxes.append(box) else: - global_boxes[i.uuid] = box + global_boxes[child.uuid] = box if diagram.display_parent_relation: - if i == diagram.target.parent: + if child == diagram.target.parent: _move_edge_to_local_edges( box, connections, local_ports, diagram, data ) - elif i.parent == diagram.target.parent: - parent_box = global_boxes[i.parent.uuid] + elif child.parent == diagram.target.parent: + parent_box = global_boxes[child.parent.uuid] parent_box.setdefault("children", []).append( - global_boxes.pop(i.uuid) + global_boxes.pop(child.uuid) ) _move_edge_to_local_edges( parent_box, connections, local_ports, diagram, data diff --git a/capellambse_context_diagrams/serializers.py b/capellambse_context_diagrams/serializers.py index a9f67460..259a5aa6 100644 --- a/capellambse_context_diagrams/serializers.py +++ b/capellambse_context_diagrams/serializers.py @@ -106,7 +106,7 @@ def deserialize_child( class type that stores all previously named classes. """ styleclass: str | None = self.get_styleclass(child["id"]) - element: diagram.Box | diagram.Edge + element: diagram.Box | diagram.Edge | diagram.Circle if child["type"] in {"node", "port"}: assert parent is None or isinstance(parent, diagram.Box) has_symbol_cls = False