Parcourir la source

* Patch from Eric Grange to fix TRectF.FitInto

Michaël Van Canneyt il y a 6 mois
Parent
commit
28fc3da2bd
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      rtl/objpas/types.pp

+ 3 - 2
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;