Changeset 103 for trunk


Ignore:
Timestamp:
Sep 28, 2022, 10:14:34 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Division by zero in view zoom level calculation on Windows.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UEngine.pas

    r102 r103  
    18501850    else AvailableImprovements := AvailableImprovements - [miLine];
    18511851
     1852  // Select offered improvements
    18521853  Improvements := TList<TMetroImprovement>.Create;
    18531854  try
  • trunk/UView.pas

    r98 r103  
    5858  if RectEquals(FSourceRect, AValue) then Exit;
    5959  FSourceRect := AValue;
    60   ZX := (FDestRect.Right - FDestRect.Left) / (FSourceRect.Right - FSourceRect.Left);
    61   ZY := (FDestRect.Bottom - FDestRect.Top) / (FSourceRect.Bottom - FSourceRect.Top);
    62   if  ZX > ZY then
    63     Zoom := ZY
    64     else Zoom := ZX;
     60  if ((FSourceRect.Right - FSourceRect.Left) <> 0) and
     61  ((FSourceRect.Bottom - FSourceRect.Top) <> 0) then begin
     62    ZX := (FDestRect.Right - FDestRect.Left) / (FSourceRect.Right - FSourceRect.Left);
     63    ZY := (FDestRect.Bottom - FDestRect.Top) / (FSourceRect.Bottom - FSourceRect.Top);
     64    if ZX > ZY then
     65      Zoom := ZY
     66      else Zoom := ZX;
     67  end else Zoom := 1;
    6568end;
    6669
Note: See TracChangeset for help on using the changeset viewer.