fixed overlapping arrows with multiple depends
This commit is contained in:
parent
5a4d30e162
commit
d61a707591
1
range.py
1
range.py
@ -18,6 +18,7 @@ class Range:
|
||||
self.description = description
|
||||
self.values = values
|
||||
self.dependsOn = dependsOn
|
||||
self.lastValueY = -1
|
||||
|
||||
@property
|
||||
def bits(self) -> int:
|
||||
|
15
renderer.py
15
renderer.py
@ -193,8 +193,13 @@ class Renderer:
|
||||
rWidth = range_.bits * bitW
|
||||
|
||||
self.drawUnderbracket(rStartX, rStartX + rWidth, bitsY)
|
||||
prevY = bitsY + bitH * 1.5
|
||||
dependRange = struct.ranges[range_.dependsOn]
|
||||
prevRangeY = bitsY + bitH * 1.5
|
||||
if dependRange.lastValueY == -1:
|
||||
prevDependY = bitsY + bitH * 1.5
|
||||
else:
|
||||
prevDependY = dependRange.lastValueY
|
||||
|
||||
dependStartI = struct.bits - dependRange.end - 1
|
||||
dependStartX = bitsX + dependStartI * bitW
|
||||
dependWidth = dependRange.bits * bitW
|
||||
@ -202,7 +207,7 @@ class Renderer:
|
||||
self.drawUnderbracket(dependStartX, dependStartX + dependWidth, bitsY)
|
||||
|
||||
for val, data in sorted(range_.values.items(), key=lambda vd: vd[0]):
|
||||
self.drawArrow(dependMid, prevY, dependMid, descY - arrowMargin)
|
||||
self.drawArrow(dependMid, prevDependY, dependMid, descY - arrowMargin)
|
||||
|
||||
valRanges = {}
|
||||
for i in range(dependRange.bits):
|
||||
@ -234,11 +239,13 @@ class Renderer:
|
||||
self.drawArrow(x1, y, x2, y, data["description"])
|
||||
|
||||
self.drawArrow(rStartX + rWidth - bitW,
|
||||
prevY,
|
||||
prevRangeY,
|
||||
rStartX + rWidth - bitW,
|
||||
descY + bitH - arrowMargin)
|
||||
|
||||
prevY = descY + bitH*2 + arrowMargin
|
||||
prevDependY = descY + bitH*2 + arrowMargin
|
||||
prevRangeY =prevDependY
|
||||
dependRange.lastValueY = prevDependY
|
||||
descY = self.drawStructure(structures[data["structure"]], structures, rStartX, descY)
|
||||
|
||||
return (descX, descY)
|
||||
|
Loading…
Reference in New Issue
Block a user