Skip to content

Commit

Permalink
prmr#402 Force non-centered labels in segmented style to align top-left
Browse files Browse the repository at this point in the history
  • Loading branch information
yannsartori committed Jan 14, 2021
1 parent a49c940 commit acc1526
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ private static void drawString(GraphicsContext pGraphics, Point2D pEndPoint1, Po
textY = bounds.getHeight() - textDimensions(pString).height()/2;
pGraphics.setTextBaseline(VPos.CENTER);
pGraphics.setTextAlign(TextAlignment.CENTER);
}
else
{
pGraphics.setTextBaseline(VPos.TOP);
pGraphics.setTextAlign(TextAlignment.LEFT);
}
pGraphics.fillText(pString, textX, textY);
pGraphics.translate(-bounds.getX(), -bounds.getY());
Expand Down

1 comment on commit acc1526

@yannsartori
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the tests I ran, this method got called multiple times for labeling the same edge. In these calls the alignment changed (varying from center,center to top,left), which was why the labels were changing.

Please sign in to comment.