Update MapPanel.cs

This commit is contained in:
Clemens 2022-02-25 20:58:48 +01:00
parent 6a14d740e8
commit 535161c5a3

View file

@ -3,7 +3,9 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Diagnostics;
using System.Linq;
using System.Security.Policy;
#if WINUI
using Windows.Foundation;
using Microsoft.UI.Xaml;
@ -219,23 +221,30 @@ namespace MapControl
}
}
if (position.HasValue)
try
{
ArrangeElement(element, position.Value);
}
else
{
var boundingBox = GetBoundingBox(element);
if (boundingBox != null)
if (position.HasValue)
{
ArrangeElement(element, GetViewRect(boundingBox));
ArrangeElement(element, position.Value);
}
else
{
ArrangeElement(element, finalSize);
var boundingBox = GetBoundingBox(element);
if (boundingBox != null)
{
ArrangeElement(element, GetViewRect(boundingBox));
}
else
{
ArrangeElement(element, finalSize);
}
}
}
catch (Exception ex)
{
Debug.WriteLine($"MapPanel.ArrangeElement: {ex.Message}");
}
}
}