mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 15:10:16 +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);
|
procedure TLegendItem.Draw(ADrawer: IChartDrawer; const ARect: TRect);
|
||||||
var
|
var
|
||||||
symTextSpc: Integer;
|
symTextSpc: Integer;
|
||||||
|
P: TPoint;
|
||||||
begin
|
begin
|
||||||
symTextSpc := ADrawer.Scale(SYMBOL_TEXT_SPACING);
|
symTextSpc := ADrawer.Scale(SYMBOL_TEXT_SPACING);
|
||||||
|
P := ADrawer.TextExtent(FText, FTextFormat);
|
||||||
if ADrawer.GetRightToLeft then
|
if ADrawer.GetRightToLeft then
|
||||||
ADrawer.TextOut.
|
ADrawer.TextOut.
|
||||||
TextFormat(FTextFormat).
|
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
|
Text(FText).Done
|
||||||
else
|
else
|
||||||
ADrawer.TextOut.
|
ADrawer.TextOut.
|
||||||
TextFormat(FTextFormat).
|
TextFormat(FTextFormat).
|
||||||
Pos(ARect.Right + symTextSpc, ARect.Top).
|
Pos(ARect.Right + symTextSpc, (ARect.Top + ARect.Bottom - P.Y) div 2).
|
||||||
Text(FText).Done;
|
Text(FText).Done;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user