Add label location description param for graphics path anchor

ordermodepps_backup
Tyler Goodlet 2021-07-17 16:17:36 -04:00
parent 34a773821e
commit 1a870364c5
1 changed files with 15 additions and 5 deletions

View File

@ -158,16 +158,26 @@ def update_pp_nav(
label.update()
def path_topright(
def gpath_pin(
gpath: QGraphicsPathItem,
label: Label, # noqa
location_description: str = 'right-of-path-centered',
use_right_of_pp_label: bool = False,
) -> QPointF:
# get actual arrow graphics path
path_br = gpath.mapToScene(
gpath.path()
).boundingRect()
path_br = gpath.mapToScene(gpath.path()).boundingRect()
# vb.locate(arrow_path) #, children=True)
return path_br.topRight() - QPointF(0, label.h / 3)
if location_description == 'right-of-path-centered':
return path_br.topRight() - QPointF(0, label.h / 3)
elif location_description == 'below-path-left-aligned':
return path_br.bottomLeft() - QPointF(0, label.h / 6)
elif location_description == 'below-path-right-aligned':
return path_br.bottomRight() - QPointF(label.w, label.h / 6)