Avalonia: ignore coercing default ZoomLevel value

This commit is contained in:
ClemensFischer 2024-05-24 21:27:04 +02:00
parent 35c0076336
commit 98847f5d86
4 changed files with 19 additions and 12 deletions

View file

@ -35,6 +35,8 @@ namespace MapControl
/// </summary>
public partial class MapBase : MapPanel
{
private const double DefaultZoomLevel = 1d;
public static TimeSpan ImageFadeDuration { get; set; } = TimeSpan.FromSeconds(0.1);
public static readonly DependencyProperty AnimationDurationProperty =
@ -418,7 +420,12 @@ namespace MapControl
private double CoerceZoomLevelProperty(double zoomLevel)
{
return Math.Min(Math.Max(zoomLevel, MinZoomLevel), MaxZoomLevel);
if (zoomLevel != DefaultZoomLevel) // Avalonia: ignore coercing default value
{
zoomLevel = Math.Min(Math.Max(zoomLevel, MinZoomLevel), MaxZoomLevel);
}
return zoomLevel;
}
private double CoerceHeadingProperty(double heading)