@@ -19,16 +19,16 @@ namespace visualizer {
1919NetworkNodeCanvasVisualization::Annotation::Annotation (cFigure *figure, const cFigure::Point& size, Placement placementHint, double placementPriority) :
2020 figure (figure),
2121 bounds (cFigure::Rectangle(NaN, NaN, size.x, size.y)),
22- topLeft (0.0 , 0.0 ),
22+ figureOffset (0.0 , 0.0 ),
2323 placementHint (placementHint),
2424 placementPriority (placementPriority)
2525{
2626}
2727
28- NetworkNodeCanvasVisualization::Annotation::Annotation (cFigure *figure, const cFigure::Point& topLeft, const cFigure::Point& size, Placement placementHint, double placementPriority) :
28+ NetworkNodeCanvasVisualization::Annotation::Annotation (cFigure *figure, const cFigure::Rectangle& bounds, Placement placementHint, double placementPriority) :
2929 figure (figure),
30- bounds (cFigure::Rectangle(NaN, NaN, size.x, size.y )),
31- topLeft (topLeft ),
30+ bounds (cFigure::Rectangle(NaN, NaN, bounds.width, bounds.height )),
31+ figureOffset (-bounds.x, -bounds.y ),
3232 placementHint (placementHint),
3333 placementPriority (placementPriority)
3434{
@@ -68,7 +68,7 @@ void NetworkNodeCanvasVisualization::refreshDisplay()
6868
6969void NetworkNodeCanvasVisualization::addAnnotation (cFigure *figure, cFigure::Rectangle bounds, Placement placementHint, double placementPriority)
7070{
71- annotations.push_back (Annotation (figure, cFigure::Point ( bounds. x , bounds. y ), bounds. getSize () , placementHint, placementPriority));
71+ annotations.push_back (Annotation (figure, bounds, placementHint, placementPriority));
7272 annotationFigure->addFigure (figure);
7373 isLayoutInvalid = true ;
7474}
@@ -337,7 +337,7 @@ void NetworkNodeCanvasVisualization::layout()
337337 // store position and rectangle
338338 annotation.bounds .x = bestRc.x + annotationSpacing / 2 ;
339339 annotation.bounds .y = bestRc.y + annotationSpacing / 2 ;
340- annotation.figure ->setTransform (cFigure::Transform ().translate (annotation.bounds .x - annotation.topLeft .x , annotation.bounds .y - annotation.topLeft .y ));
340+ annotation.figure ->setTransform (cFigure::Transform ().translate (annotation.bounds .x + annotation.figureOffset .x , annotation.bounds .y + annotation.figureOffset .y ));
341341
342342 // delete candidate points covered by best rc
343343 for (auto j = pts.begin (); j != pts.end ();) {
0 commit comments