diff --git a/birdvisu/visualisation/annotators.py b/birdvisu/visualisation/annotators.py index 766d3ee..c7f9e76 100644 --- a/birdvisu/visualisation/annotators.py +++ b/birdvisu/visualisation/annotators.py @@ -140,9 +140,14 @@ def create_qgritems(at): x = pos.x y = pos.y - shape = QtWidgets.QGraphicsRectItem(x, y, size, size) + shape = QtWidgets.QGraphicsRectItem(-size/2, -size/2, size, size) shape.setBrush(brush) + shape.setPos(x, y) label = QtWidgets.QGraphicsSimpleTextItem(rk, parent=shape) + label.setY(size*0.8) + # Centering: + text_width = label.boundingRect().width() + label.setX(-text_width/2) at.router_annotations[rk].append(shape) for nk, n in topo.networks.items(): @@ -160,9 +165,14 @@ def create_qgritems(at): x = pos.x y = pos.y - shape = QtWidgets.QGraphicsRectItem(x, y, size, size) + shape = QtWidgets.QGraphicsRectItem(-size/2, -size/2, size, size) shape.setBrush(brush) + shape.setPos(x, y) label = QtWidgets.QGraphicsSimpleTextItem(nk, parent=shape) + label.setY(size*0.8) + # Centering: + text_width = label.boundingRect().width() + label.setX(-text_width/2) at.network_annotations[nk].append(shape) for lk, l in topo.links.items():