mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Added BoundingBox.Rotation
This commit is contained in:
parent
df661106b6
commit
af3a45064d
3 changed files with 43 additions and 56 deletions
|
|
@ -277,12 +277,7 @@ namespace MapControl
|
|||
|
||||
if (boundingBox != null)
|
||||
{
|
||||
var rect = GetViewRect(boundingBox);
|
||||
|
||||
if (rect.HasValue)
|
||||
{
|
||||
ArrangeElement(element, rect.Value, parentMap.ViewTransform.Rotation);
|
||||
}
|
||||
ArrangeElement(element, boundingBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -291,20 +286,27 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private static void ArrangeElement(FrameworkElement element, Rect rect, double rotation)
|
||||
private void ArrangeElement(FrameworkElement element, BoundingBox boundingBox)
|
||||
{
|
||||
element.Width = rect.Width;
|
||||
element.Height = rect.Height;
|
||||
var rect = GetViewRect(boundingBox);
|
||||
|
||||
element.Arrange(rect);
|
||||
if (rect.HasValue)
|
||||
{
|
||||
element.Width = rect.Value.Width;
|
||||
element.Height = rect.Value.Height;
|
||||
|
||||
if (element.RenderTransform is RotateTransform rotateTransform)
|
||||
{
|
||||
rotateTransform.Angle = rotation;
|
||||
}
|
||||
else if (rotation != 0d)
|
||||
{
|
||||
SetRenderTransform(element, new RotateTransform { Angle = rotation }, 0.5, 0.5);
|
||||
element.Arrange(rect.Value);
|
||||
|
||||
var rotation = parentMap.ViewTransform.Rotation - boundingBox.Rotation;
|
||||
|
||||
if (element.RenderTransform is RotateTransform rotateTransform)
|
||||
{
|
||||
rotateTransform.Angle = rotation;
|
||||
}
|
||||
else if (rotation != 0d)
|
||||
{
|
||||
SetRenderTransform(element, new RotateTransform { Angle = rotation }, 0.5, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue