diff --git a/renderer.py b/renderer.py index 197b82f..bac28cc 100644 --- a/renderer.py +++ b/renderer.py @@ -217,12 +217,19 @@ class Renderer: self.drawStructure(valStruct, structures, dependStartX, descY) - valueRight = dependStartX + dependWidth - self.drawArrow(valueRight + arrowMargin, - descY + bitH*1.5, - rStartX - arrowMargin, - descY + bitH*1.5, - data["description"]) + y = descY + bitH * 1.5 + + # Arrow from left to right + if dependRange.end > range_.start: + x1 = dependStartX + dependWidth + arrowMargin + x2 = rStartX - arrowMargin + + # Arrow from right to left + else: + x1 = dependStartX - arrowMargin + x2 = rStartX + rWidth + arrowMargin + + self.drawArrow(x1, y, x2, y, data["description"]) self.drawArrow(rStartX + rWidth - bitW, prevY,