mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-05-07 13:37:47 +00:00
File scoped namespaces
This commit is contained in:
parent
c14377f976
commit
65aba44af6
152 changed files with 11962 additions and 12115 deletions
|
|
@ -9,54 +9,53 @@ using Microsoft.UI.Xaml;
|
|||
using Avalonia;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
namespace MapControl;
|
||||
|
||||
/// <summary>
|
||||
/// MapBase with default input event handling.
|
||||
/// </summary>
|
||||
public partial class Map : MapBase
|
||||
{
|
||||
public static readonly DependencyProperty MouseWheelZoomDeltaProperty =
|
||||
DependencyPropertyHelper.Register<Map, double>(nameof(MouseWheelZoomDelta), 0.25);
|
||||
|
||||
public static readonly DependencyProperty MouseWheelZoomAnimatedProperty =
|
||||
DependencyPropertyHelper.Register<Map, bool>(nameof(MouseWheelZoomAnimated), true);
|
||||
|
||||
/// <summary>
|
||||
/// MapBase with default input event handling.
|
||||
/// Gets or sets the amount by which the ZoomLevel property changes by a MouseWheel event.
|
||||
/// The default value is 0.25.
|
||||
/// </summary>
|
||||
public partial class Map : MapBase
|
||||
public double MouseWheelZoomDelta
|
||||
{
|
||||
public static readonly DependencyProperty MouseWheelZoomDeltaProperty =
|
||||
DependencyPropertyHelper.Register<Map, double>(nameof(MouseWheelZoomDelta), 0.25);
|
||||
get => (double)GetValue(MouseWheelZoomDeltaProperty);
|
||||
set => SetValue(MouseWheelZoomDeltaProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty MouseWheelZoomAnimatedProperty =
|
||||
DependencyPropertyHelper.Register<Map, bool>(nameof(MouseWheelZoomAnimated), true);
|
||||
/// <summary>
|
||||
/// Gets or sets a value that specifies whether zooming by a MouseWheel event is animated.
|
||||
/// The default value is true.
|
||||
/// </summary>
|
||||
public bool MouseWheelZoomAnimated
|
||||
{
|
||||
get => (bool)GetValue(MouseWheelZoomAnimatedProperty);
|
||||
set => SetValue(MouseWheelZoomAnimatedProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount by which the ZoomLevel property changes by a MouseWheel event.
|
||||
/// The default value is 0.25.
|
||||
/// </summary>
|
||||
public double MouseWheelZoomDelta
|
||||
private void OnMouseWheel(Point position, double delta)
|
||||
{
|
||||
var zoomLevel = TargetZoomLevel + MouseWheelZoomDelta * delta;
|
||||
var animated = false;
|
||||
|
||||
if (delta <= -1d || delta >= 1d)
|
||||
{
|
||||
get => (double)GetValue(MouseWheelZoomDeltaProperty);
|
||||
set => SetValue(MouseWheelZoomDeltaProperty, value);
|
||||
// Zoom to integer multiple of MouseWheelZoomDelta when the event was raised by a
|
||||
// mouse wheel or by a large movement on a touch pad or other high resolution device.
|
||||
//
|
||||
zoomLevel = MouseWheelZoomDelta * Math.Round(zoomLevel / MouseWheelZoomDelta);
|
||||
animated = MouseWheelZoomAnimated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that specifies whether zooming by a MouseWheel event is animated.
|
||||
/// The default value is true.
|
||||
/// </summary>
|
||||
public bool MouseWheelZoomAnimated
|
||||
{
|
||||
get => (bool)GetValue(MouseWheelZoomAnimatedProperty);
|
||||
set => SetValue(MouseWheelZoomAnimatedProperty, value);
|
||||
}
|
||||
|
||||
private void OnMouseWheel(Point position, double delta)
|
||||
{
|
||||
var zoomLevel = TargetZoomLevel + MouseWheelZoomDelta * delta;
|
||||
var animated = false;
|
||||
|
||||
if (delta <= -1d || delta >= 1d)
|
||||
{
|
||||
// Zoom to integer multiple of MouseWheelZoomDelta when the event was raised by a
|
||||
// mouse wheel or by a large movement on a touch pad or other high resolution device.
|
||||
//
|
||||
zoomLevel = MouseWheelZoomDelta * Math.Round(zoomLevel / MouseWheelZoomDelta);
|
||||
animated = MouseWheelZoomAnimated;
|
||||
}
|
||||
|
||||
ZoomMap(position, zoomLevel, animated);
|
||||
}
|
||||
ZoomMap(position, zoomLevel, animated);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue