From 28fc3da2bda2cb959f61ce3405dddb246fa00e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Fri, 24 Jan 2025 11:53:05 +0100 Subject: [PATCH] * Patch from Eric Grange to fix TRectF.FitInto --- rtl/objpas/types.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rtl/objpas/types.pp b/rtl/objpas/types.pp index 9feff0fbfb..3aa6eadf17 100644 --- a/rtl/objpas/types.pp +++ b/rtl/objpas/types.pp @@ -1701,8 +1701,9 @@ begin exit(Self); Result.Width:=Self.Width / Ratio; Result.Height:=Self.Height / Ratio; - Result.Left:=Self.Left + (Self.Width - Result.Width) / 2; - Result.Top:=Self.Top + (Self.Height - Result.Height) / 2; + // Center the result within the Dest rectangle + Result.Left:=Dest.Left + (Dest.Width - Result.Width) / 2; + Result.Top:=Dest.Top + (Dest.Height - Result.Height) / 2; end; function TRectF.FitInto(const Dest: TRectF): TRectF;