Skip to content

Commit

Permalink
Make bubble wires go straight (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
toumix committed Apr 15, 2024
1 parent c6815c6 commit 2bac279
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions discopy/drawing/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def add_box(scan, box, off, depth, x_pos):
for i, obj in enumerate(box.cod.inside):
position = (
pos[scan[off + i]][0] if len(box.dom) == len(box.cod)
else pos[scan[off + i + 1]][0] if bubble_closing
else x_pos - len(box.cod[1:]) / 2 + i,
len(diagram) - depth - .75)
wire = Node("cod", obj=obj, i=i, depth=depth)
Expand Down
5 changes: 5 additions & 0 deletions test/drawing/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def merge(x):
>> merge(white) @ merge(yolk)


@draw_and_compare("bubble-straight-wire.png", draw_type_labels=False)
def test_draw_bubble_wires():
return (Ty('x') @ Box('s', Ty(), Ty())).bubble()


@draw_and_compare(
'spiral.png', draw_type_labels=False,
draw_box_labels=False, aspect='equal')
Expand Down
Binary file added test/src/imgs/bubble-straight-wire.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2bac279

Please sign in to comment.