mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Default Map Background
This commit is contained in:
parent
25dc5dc139
commit
3c907c3345
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// Copyright © 2024 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Avalonia.Controls;
|
||||
using System;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ global using Avalonia;
|
|||
using Avalonia.Animation;
|
||||
using Avalonia.Animation.Easings;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Styling;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -75,16 +76,12 @@ namespace MapControl
|
|||
|
||||
static MapBase()
|
||||
{
|
||||
BackgroundProperty.OverrideDefaultValue(typeof(MapBase), Brushes.White);
|
||||
ClipToBoundsProperty.OverrideDefaultValue(typeof(MapBase), true);
|
||||
|
||||
Animation.RegisterCustomAnimator<Location, LocationAnimator>();
|
||||
}
|
||||
|
||||
public MapBase()
|
||||
{
|
||||
MapProjectionPropertyChanged(MapProjection);
|
||||
}
|
||||
|
||||
internal Size RenderSize => Bounds.Size;
|
||||
|
||||
protected override void OnSizeChanged(SizeChangedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ using Microsoft.UI.Xaml;
|
|||
using Microsoft.UI.Xaml.Media;
|
||||
#elif AVALONIA
|
||||
using Avalonia.Media;
|
||||
using Brush = Avalonia.Media.IBrush;
|
||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||
using UIElement = Avalonia.Controls.Control;
|
||||
#endif
|
||||
|
|
@ -60,7 +61,7 @@ namespace MapControl
|
|||
private Location transformCenter;
|
||||
private Point viewCenter;
|
||||
private double centerLongitude;
|
||||
private double maxLatitude = 90d;
|
||||
private double maxLatitude = 85.05112878; // default WebMercatorProjection
|
||||
private bool internalPropertyChange;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using Brush = Avalonia.Media.IBrush;
|
||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||
using ImageSource = Avalonia.Media.IImage;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ using DispatcherTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using Brush = Avalonia.Media.IBrush;
|
||||
using DependencyProperty = Avalonia.AvaloniaProperty;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ namespace MapControl
|
|||
public MapBase()
|
||||
{
|
||||
// Set Background by Style to enable resetting by ClearValue in MapLayerPropertyChanged.
|
||||
// There is no default Style in Generic.xaml because MapBase has no DefaultStyleKey property.
|
||||
//
|
||||
var style = new Style(typeof(MapBase));
|
||||
style.Setters.Add(new Setter(BackgroundProperty, new SolidColorBrush(Colors.White)));
|
||||
|
|
|
|||
Loading…
Reference in a new issue