Open lolipopshock opened 3 years ago
Describe the bug When the input sequence is ordered differently from the element ids, the lp.draw_box will create inconsistent id annotation in the visualization.
lp.draw_box
To Reproduce Example:
background = Image.new('RGB', (1000,1000), color='white') layout = lp.Layout( [ lp.TextBlock(block=lp.Rectangle(x_1=80, y_1=79.0, x_2=490, y_2=92.0), text=None, id=1, type=None, parent=0, next=None), lp.TextBlock(block=lp.Rectangle(x_1=80, y_1=65.0, x_2=488.0, y_2=77.0), text=None, id=0, type=None, parent=0, next=None), lp.TextBlock(block=lp.Rectangle(x_1=80.0, y_1=95.0, x_2=490, y_2=107.0), text=None, id=2, type=None, parent=0, next=None), lp.TextBlock(block=lp.Rectangle(x_1=80, y_1=110.0, x_2=490, y_2=122.0), text=None, id=3, type=None, parent=0, next=None), lp.TextBlock(block=lp.Rectangle(x_1=80.0, y_1=125.0, x_2=490.0, y_2=138.0), text=None, id=4, type=None, parent=0, next=None) ] ).scale((1,2)) lp.draw_box(background, layout, show_element_id=True)
Expected output:
Actual output:
Temporary fix:
lp.draw_box(background, [b.set(id=str(b.id)) for b in layout], show_element_id=True)
Describe the bug When the input sequence is ordered differently from the element ids, the
lp.draw_box
will create inconsistent id annotation in the visualization.To Reproduce Example:
Expected output:
Actual output:
Temporary fix: