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
|
|
@ -7,65 +7,64 @@ using Microsoft.UI.Input;
|
|||
using Microsoft.UI.Xaml.Input;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
namespace MapControl;
|
||||
|
||||
public partial class Map
|
||||
{
|
||||
public partial class Map
|
||||
public Map()
|
||||
{
|
||||
public Map()
|
||||
ManipulationMode
|
||||
= ManipulationModes.Scale
|
||||
| ManipulationModes.TranslateX
|
||||
| ManipulationModes.TranslateY
|
||||
| ManipulationModes.TranslateInertia;
|
||||
|
||||
PointerWheelChanged += OnPointerWheelChanged;
|
||||
PointerMoved += OnPointerMoved;
|
||||
ManipulationDelta += OnManipulationDelta;
|
||||
ManipulationCompleted += OnManipulationCompleted;
|
||||
}
|
||||
|
||||
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)
|
||||
{
|
||||
ManipulationMode
|
||||
= ManipulationModes.Scale
|
||||
| ManipulationModes.TranslateX
|
||||
| ManipulationModes.TranslateY
|
||||
| ManipulationModes.TranslateInertia;
|
||||
var point = e.GetCurrentPoint(this);
|
||||
|
||||
PointerWheelChanged += OnPointerWheelChanged;
|
||||
PointerMoved += OnPointerMoved;
|
||||
ManipulationDelta += OnManipulationDelta;
|
||||
ManipulationCompleted += OnManipulationCompleted;
|
||||
}
|
||||
|
||||
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)
|
||||
{
|
||||
var point = e.GetCurrentPoint(this);
|
||||
|
||||
// Standard mouse wheel delta value is 120.
|
||||
//
|
||||
OnMouseWheel(point.Position, point.Properties.MouseWheelDelta / 120d);
|
||||
}
|
||||
}
|
||||
|
||||
private bool? manipulationEnabled;
|
||||
|
||||
private void OnPointerMoved(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
if (!manipulationEnabled.HasValue &&
|
||||
e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
|
||||
{
|
||||
manipulationEnabled = e.KeyModifiers == VirtualKeyModifiers.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
|
||||
{
|
||||
if (manipulationEnabled.HasValue && manipulationEnabled.Value)
|
||||
{
|
||||
if (e.PointerDeviceType == PointerDeviceType.Mouse)
|
||||
{
|
||||
TranslateMap(e.Delta.Translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
|
||||
{
|
||||
manipulationEnabled = null;
|
||||
// Standard mouse wheel delta value is 120.
|
||||
//
|
||||
OnMouseWheel(point.Position, point.Properties.MouseWheelDelta / 120d);
|
||||
}
|
||||
}
|
||||
|
||||
private bool? manipulationEnabled;
|
||||
|
||||
private void OnPointerMoved(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
if (!manipulationEnabled.HasValue &&
|
||||
e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
|
||||
{
|
||||
manipulationEnabled = e.KeyModifiers == VirtualKeyModifiers.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
|
||||
{
|
||||
if (manipulationEnabled.HasValue && manipulationEnabled.Value)
|
||||
{
|
||||
if (e.PointerDeviceType == PointerDeviceType.Mouse)
|
||||
{
|
||||
TranslateMap(e.Delta.Translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
|
||||
{
|
||||
manipulationEnabled = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue