mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 18:08:35 +02:00
TAChart: Improved alignment of legend text when single- and multi-line legend items are mixed.
This commit is contained in:
parent
33801729a2
commit
0933dadcaf
@ -409,17 +409,19 @@ end;
|
||||
procedure TLegendItem.Draw(ADrawer: IChartDrawer; const ARect: TRect);
|
||||
var
|
||||
symTextSpc: Integer;
|
||||
P: TPoint;
|
||||
begin
|
||||
symTextSpc := ADrawer.Scale(SYMBOL_TEXT_SPACING);
|
||||
P := ADrawer.TextExtent(FText, FTextFormat);
|
||||
if ADrawer.GetRightToLeft then
|
||||
ADrawer.TextOut.
|
||||
TextFormat(FTextFormat).
|
||||
Pos(ARect.Left - symTextSpc - ADrawer.TextExtent(FText, FTextFormat).X, ARect.Top).
|
||||
Pos(ARect.Left - symTextSpc - P.X, (ARect.Top + ARect.Bottom - P.Y) div 2).
|
||||
Text(FText).Done
|
||||
else
|
||||
ADrawer.TextOut.
|
||||
TextFormat(FTextFormat).
|
||||
Pos(ARect.Right + symTextSpc, ARect.Top).
|
||||
Pos(ARect.Right + symTextSpc, (ARect.Top + ARect.Bottom - P.Y) div 2).
|
||||
Text(FText).Done;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user