Update MapPanel.cs

This commit is contained in:
ClemensFischer 2024-08-29 10:56:41 +02:00
parent a7ff9fe97a
commit 94c3faf805

View file

@ -216,14 +216,14 @@ namespace MapControl
protected ViewRect GetViewRect(Rect mapRect) protected ViewRect GetViewRect(Rect mapRect)
{ {
var rectCenter = new Point(mapRect.X + mapRect.Width / 2d, mapRect.Y + mapRect.Height / 2d); var center = new Point(mapRect.X + mapRect.Width / 2d, mapRect.Y + mapRect.Height / 2d);
var position = parentMap.ViewTransform.MapToView(rectCenter); var position = parentMap.ViewTransform.MapToView(center);
var projection = parentMap.MapProjection; var projection = parentMap.MapProjection;
if (projection.Type <= MapProjectionType.NormalCylindrical && if (projection.Type <= MapProjectionType.NormalCylindrical &&
!InsideViewport(position)) !InsideViewport(position))
{ {
var location = projection.MapToLocation(rectCenter); var location = projection.MapToLocation(center);
if (location != null) if (location != null)
{ {