From 7dc9d76d238a0b68b44e1862f056e5842eb22347 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Sat, 23 Mar 2024 23:59:53 +0100 Subject: [PATCH] fixed right to left dependencies --- renderer.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) 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,