Commit 2ae931e9 authored by Michael Büsch's avatar Michael Büsch

gui/fup/conn: Separate connection anchor point from draw offset

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent c5a2a7c8
......@@ -126,9 +126,17 @@ class FupConn(FupBaseClass):
def drawOffset(self):
"""Get the draw offset; in X direction.
"""
if not self.isConnected:
return self.anchorOffset
return 0
@property
def anchorOffset(self):
"""Get the anchor offset; in X direction.
"""
elem = self.elem
if elem:
return elem._connDrawOffset
return elem._connAnchorOffset
return 0
@property
......
......@@ -368,11 +368,11 @@ class FupElem(FupBaseClass):
cellPixHeight = self.grid.cellPixHeight
cellPixWidth = self.grid.cellPixWidth
if conn.IN:
xPix = (x * cellPixWidth) + conn.drawOffset
xPix = (x * cellPixWidth) + conn.anchorOffset
yPix = (y * cellPixHeight) + (cellPixHeight // 2)
return xPix, yPix
elif conn.OUT:
xPix = (x * cellPixWidth) + cellPixWidth - conn.drawOffset
xPix = (x * cellPixWidth) + cellPixWidth - conn.anchorOffset
yPix = (y * cellPixHeight) + (cellPixHeight // 2)
return xPix, yPix
raise IndexError
......@@ -415,7 +415,7 @@ class FupElem(FupBaseClass):
return 0
@property
def _connDrawOffset(self):
def _connAnchorOffset(self):
"""The connection offset in X direction.
"""
return int(round(self._xpadding * 0.5))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment