Ignore:
Timestamp:
Sep 22, 2018, 1:07:53 PM (6 years ago)
Author:
chronos
Message:
  • Added: Limit minimum and maximum map zoom.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormClient.pas

    r243 r245  
    1212const
    1313  ZoomFactor = 1.5;
     14  MinZoom = 0.05;
     15  MaxZoom = 10;
    1416  MouseMinDiff = 0.1;
    1517
     
    447449begin
    448450  with Client do begin
    449     View.Zoom := View.Zoom * ZoomFactor;
     451    if View.Zoom * ZoomFactor < MaxZoom then
     452      View.Zoom := View.Zoom * ZoomFactor;
    450453  end;
    451454  Redraw;
     
    453456
    454457procedure TFormClient.AZoomOutExecute(Sender: TObject);
    455 //var
    456 //  D: TPoint;
    457458begin
    458459  with Client do begin
    459     //D := Point(Trunc(MousePos.X - View.Left / ViewZoom),
    460     //  Trunc(MousePos.Y - View.Top / ViewZoom));
    461     View.Zoom := View.Zoom / ZoomFactor;
    462     //View := Bounds(Trunc((D.X - MousePos.X) * ViewZoom),
    463     //  Trunc((D.Y - MousePos.Y) * ViewZoom),
    464     //  View.Right - View.Left,
    465     //  View.Bottom - View.Top);
     460    if View.Zoom / ZoomFactor > MinZoom then
     461      View.Zoom := View.Zoom / ZoomFactor;
    466462  end;
    467463  Redraw;
Note: See TracChangeset for help on using the changeset viewer.