LazMapViewer: Restrict zoom level to allowed range. Part of issue #39111.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9665 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2025-03-08 21:28:25 +00:00
parent 637f4bbf66
commit d80d4c79f5

View File

@ -939,17 +939,14 @@ begin
Val := 1;
if WheelDelta < 0 then
Val := -1;
nZoom := Zoom + Val;
if (nZoom >= FZoomMin) and (nZoom <= FZoomMax) then
nZoom := EnsureRange(Zoom + Val, FZoomMin, FZoomMax);
if ZoomToCursor then
begin
if ZoomToCursor then
begin
MapWin.ZoomCenter := ScreenToLatLon(MousePos);
MapWin.ZoomOffset := LatLonToScreen(Center).Subtract(MousePos);
bZoomToCursor := True;
end;
SetZoom(nZoom, bZoomToCursor);
MapWin.ZoomCenter := ScreenToLatLon(MousePos);
MapWin.ZoomOffset := LatLonToScreen(Center).Subtract(MousePos);
bZoomToCursor := True;
end;
SetZoom(nZoom, bZoomToCursor);
Handled := true;
end;
@ -1509,7 +1506,7 @@ begin
tmpWin := MapWin;
tmpWin.Center.Lon := (aArea.TopLeft.Lon + aArea.BottomRight.Lon) / 2;
tmpWin.Center.Lat := (aArea.TopLeft.Lat + aArea.BottomRight.Lat) / 2;
tmpWin.Zoom := 18;
tmpWin.Zoom := FZoomMax;
TopLeft.X := 0;
TopLeft.Y := 0;
BottomRight.X := tmpWin.Width;