mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Removed UseLayoutRounding handling from MapPanel
This commit is contained in:
parent
9cb4a9be7e
commit
93b58fa01e
|
|
@ -58,7 +58,7 @@ namespace MapControl
|
||||||
(map, value) => map.CoerceHeadingProperty(value));
|
(map, value) => map.CoerceHeadingProperty(value));
|
||||||
|
|
||||||
public static readonly DirectProperty<MapBase, double> ViewScaleProperty =
|
public static readonly DirectProperty<MapBase, double> ViewScaleProperty =
|
||||||
AvaloniaProperty.RegisterDirect<MapBase, double>(nameof(ViewScale), map => map.ViewScale);
|
AvaloniaProperty.RegisterDirect<MapBase, double>(nameof(ViewScale), map => map.ViewTransform.Scale);
|
||||||
|
|
||||||
private CancellationTokenSource centerCts;
|
private CancellationTokenSource centerCts;
|
||||||
private CancellationTokenSource zoomLevelCts;
|
private CancellationTokenSource zoomLevelCts;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace MapControl
|
||||||
element.RenderTransformOrigin = new RelativePoint(originX, originY, RelativeUnit.Relative);
|
element.RenderTransformOrigin = new RelativePoint(originX, originY, RelativeUnit.Relative);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Controls ChildElements => Children;
|
protected Controls ChildElements => Children;
|
||||||
|
|
||||||
private static void SetVisible(Control element, bool visible)
|
private static void SetVisible(Control element, bool visible)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,7 @@ namespace MapControl
|
||||||
FrameworkElement overlay = new Image
|
FrameworkElement overlay = new Image
|
||||||
{
|
{
|
||||||
Source = imageOverlay.ImageSource,
|
Source = imageOverlay.ImageSource,
|
||||||
Stretch = Stretch.Fill,
|
Stretch = Stretch.Fill
|
||||||
UseLayoutRounding = false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (imageOverlay.LatLonBox.Rotation != 0d)
|
if (imageOverlay.LatLonBox.Rotation != 0d)
|
||||||
|
|
@ -115,9 +114,9 @@ namespace MapControl
|
||||||
overlay.RenderTransform = new RotateTransform { Angle = -imageOverlay.LatLonBox.Rotation };
|
overlay.RenderTransform = new RotateTransform { Angle = -imageOverlay.LatLonBox.Rotation };
|
||||||
overlay.RenderTransformOrigin = new Point(0.5, 0.5);
|
overlay.RenderTransformOrigin = new Point(0.5, 0.5);
|
||||||
|
|
||||||
// Additional Panel for map rotation, see MapPanel.ArrangeElementWithBoundingBox.
|
// Additional Panel for map rotation, see MapPanel.ArrangeElement(FrameworkElement, ViewRect).
|
||||||
//
|
//
|
||||||
var panel = new Grid { UseLayoutRounding = false };
|
var panel = new Grid();
|
||||||
panel.Children.Add(overlay);
|
panel.Children.Add(overlay);
|
||||||
overlay = panel;
|
overlay = panel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ namespace MapControl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrangeElement(element, new Rect(x, y, size.Width, size.Height));
|
element.Arrange(new Rect(x, y, size.Width, size.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ArrangeElement(FrameworkElement element, Size parentSize)
|
private static void ArrangeElement(FrameworkElement element, Size parentSize)
|
||||||
|
|
@ -371,7 +371,7 @@ namespace MapControl
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrangeElement(element, new Rect(x, y, width, height));
|
element.Arrange(new Rect(x, y, width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ArrangeElement(FrameworkElement element, ViewRect rect)
|
private static void ArrangeElement(FrameworkElement element, ViewRect rect)
|
||||||
|
|
@ -379,7 +379,7 @@ namespace MapControl
|
||||||
element.Width = rect.Rect.Width;
|
element.Width = rect.Rect.Width;
|
||||||
element.Height = rect.Rect.Height;
|
element.Height = rect.Rect.Height;
|
||||||
|
|
||||||
ArrangeElement(element, rect.Rect);
|
element.Arrange(rect.Rect);
|
||||||
|
|
||||||
if (element.RenderTransform is RotateTransform rotateTransform)
|
if (element.RenderTransform is RotateTransform rotateTransform)
|
||||||
{
|
{
|
||||||
|
|
@ -391,16 +391,6 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ArrangeElement(FrameworkElement element, Rect rect)
|
|
||||||
{
|
|
||||||
if (element.UseLayoutRounding)
|
|
||||||
{
|
|
||||||
rect = new Rect(Math.Round(rect.X), Math.Round(rect.Y), Math.Round(rect.Width), Math.Round(rect.Height));
|
|
||||||
}
|
|
||||||
|
|
||||||
element.Arrange(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Size GetDesiredSize(FrameworkElement element)
|
internal static Size GetDesiredSize(FrameworkElement element)
|
||||||
{
|
{
|
||||||
var width = 0d;
|
var width = 0d;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
#if AVALONIA
|
#if AVALONIA
|
||||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||||
using FrameworkElement = Avalonia.Controls.Control;
|
|
||||||
using ImageSource = Avalonia.Media.IImage;
|
using ImageSource = Avalonia.Media.IImage;
|
||||||
#elif WINUI
|
#elif WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
|
|
@ -38,7 +37,7 @@ namespace MapControl
|
||||||
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsLayers), null, false,
|
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsLayers), null, false,
|
||||||
async (layer, oldValue, newValue) =>
|
async (layer, oldValue, newValue) =>
|
||||||
{
|
{
|
||||||
// Ignore property change from GetImageAsync, when Layers was null.
|
// Ignore property change from GetImageAsync when Layers was null.
|
||||||
//
|
//
|
||||||
if (oldValue != null)
|
if (oldValue != null)
|
||||||
{
|
{
|
||||||
|
|
@ -50,14 +49,6 @@ namespace MapControl
|
||||||
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsStyles), string.Empty, false,
|
DependencyPropertyHelper.Register<WmsImageLayer, string>(nameof(WmsStyles), string.Empty, false,
|
||||||
async (layer, oldValue, newValue) => await layer.UpdateImageAsync());
|
async (layer, oldValue, newValue) => await layer.UpdateImageAsync());
|
||||||
|
|
||||||
public WmsImageLayer()
|
|
||||||
{
|
|
||||||
foreach (FrameworkElement child in Children)
|
|
||||||
{
|
|
||||||
child.UseLayoutRounding = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base request URL.
|
/// The base request URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace MapControl
|
||||||
element.RenderTransformOrigin = new Point(originX, originY);
|
element.RenderTransformOrigin = new Point(originX, originY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<FrameworkElement> ChildElements => Children.OfType<FrameworkElement>();
|
protected IEnumerable<FrameworkElement> ChildElements => Children.OfType<FrameworkElement>();
|
||||||
|
|
||||||
private static void SetVisible(FrameworkElement element, bool visible)
|
private static void SetVisible(FrameworkElement element, bool visible)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace MapControl
|
||||||
element.RenderTransformOrigin = new Point(originX, originY);
|
element.RenderTransformOrigin = new Point(originX, originY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<FrameworkElement> ChildElements => Children.OfType<FrameworkElement>();
|
protected IEnumerable<FrameworkElement> ChildElements => Children.OfType<FrameworkElement>();
|
||||||
|
|
||||||
private static void SetVisible(FrameworkElement element, bool visible)
|
private static void SetVisible(FrameworkElement element, bool visible)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue