MapBase.InsideViewBounds

This commit is contained in:
ClemensFischer 2024-08-30 17:35:30 +02:00
parent 02e138eb7c
commit 6a4046a838
3 changed files with 5 additions and 5 deletions

View file

@ -374,7 +374,7 @@ namespace MapControl
} }
} }
internal bool InsideViewport(Point point) internal bool InsideViewBounds(Point point)
=> point.X >= 0d && point.Y >= 0d && point.X <= ActualWidth && point.Y <= ActualHeight; => point.X >= 0d && point.Y >= 0d && point.X <= ActualWidth && point.Y <= ActualHeight;
internal double CoerceLongitude(double longitude) internal double CoerceLongitude(double longitude)

View file

@ -192,7 +192,7 @@ namespace MapControl
var position = parentMap.LocationToView(location); var position = parentMap.LocationToView(location);
if (parentMap.MapProjection.Type <= MapProjectionType.NormalCylindrical && if (parentMap.MapProjection.Type <= MapProjectionType.NormalCylindrical &&
position.HasValue && !parentMap.InsideViewport(position.Value)) position.HasValue && !parentMap.InsideViewBounds(position.Value))
{ {
var coercedPosition = parentMap.LocationToView( var coercedPosition = parentMap.LocationToView(
new Location(location.Latitude, parentMap.CoerceLongitude(location.Longitude))); new Location(location.Latitude, parentMap.CoerceLongitude(location.Longitude)));
@ -225,7 +225,7 @@ namespace MapControl
var projection = parentMap.MapProjection; var projection = parentMap.MapProjection;
if (projection.Type <= MapProjectionType.NormalCylindrical && if (projection.Type <= MapProjectionType.NormalCylindrical &&
!parentMap.InsideViewport(position)) !parentMap.InsideViewBounds(position))
{ {
var location = projection.MapToLocation(center); var location = projection.MapToLocation(center);
@ -261,7 +261,7 @@ namespace MapControl
if (GetAutoCollapse(element)) if (GetAutoCollapse(element))
{ {
SetVisible(element, position.HasValue && parentMap.InsideViewport(position.Value)); SetVisible(element, position.HasValue && parentMap.InsideViewBounds(position.Value));
} }
if (position.HasValue) if (position.HasValue)

View file

@ -84,7 +84,7 @@ namespace MapControl
{ {
var position = parentMap.LocationToView(location); var position = parentMap.LocationToView(location);
if (position.HasValue && !parentMap.InsideViewport(position.Value)) if (position.HasValue && !parentMap.InsideViewBounds(position.Value))
{ {
longitudeOffset = parentMap.CoerceLongitude(location.Longitude) - location.Longitude; longitudeOffset = parentMap.CoerceLongitude(location.Longitude) - location.Longitude;
} }