Skip to content

Commit

Permalink
merge: Don't draw port labels twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Sep 17, 2024
2 parents af2aa1a + 93f09ce commit 115c531
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
6 changes: 5 additions & 1 deletion capellambse/aird/_edge_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,14 @@ def snap_oblique(
)
delta = (points[i] - source).angleto(new_point - source)
if abs(delta) >= 1:
if len(points) >= 3:
next_point = points[next_i - i + next_i]
else:
next_point = source
new_point = target.vector_snap(
source,
style=diagram.RoutingStyle.OBLIQUE,
source=points[next_i - i + next_i],
source=next_point,
)
points[i] = new_point

Expand Down
24 changes: 13 additions & 11 deletions capellambse/svg/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,18 +555,20 @@ def _draw_symbol(
labels=floating_labels_,
id_=id_,
)
else:
gcls = "".join(f" context-{i}" for i in context_)
grp = self.__drawing.g(class_=f"Box {class_}{gcls}", id_=id_)
grp.add(
self.__drawing.use(
href=f"#{class_}Symbol",
insert=pos,
size=size,
class_=class_,
**obj_style._to_dict(),
)
self.__drawing.add(grp)
return

gcls = "".join(f" context-{i}" for i in context_)
grp = self.__drawing.g(class_=f"Box {class_}{gcls}", id_=id_)
grp.add(
self.__drawing.use(
href=f"#{class_}Symbol",
insert=pos,
size=size,
class_=class_,
**obj_style._to_dict(),
)
)

self.__drawing.add(grp)
if floating_labels_:
Expand Down

0 comments on commit 115c531

Please sign in to comment.