mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Version 5.2.1. Fixed Map.UWP OnManipulationDelta
This commit is contained in:
parent
b6e2624f1c
commit
d041fecce9
15 changed files with 47 additions and 23 deletions
|
|
@ -2,6 +2,8 @@
|
|||
// © 2020 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Input;
|
||||
|
||||
|
|
@ -15,6 +17,11 @@ namespace MapControl
|
|||
public static readonly DependencyProperty MouseWheelZoomDeltaProperty = DependencyProperty.Register(
|
||||
nameof(MouseWheelZoomDelta), typeof(double), typeof(Map), new PropertyMetadata(1d));
|
||||
|
||||
private Vector transformTranslation;
|
||||
private double transformRotation;
|
||||
private double transformScale = 1d;
|
||||
private bool transformPending;
|
||||
|
||||
public Map()
|
||||
{
|
||||
ManipulationMode = ManipulationModes.Scale
|
||||
|
|
@ -36,9 +43,26 @@ namespace MapControl
|
|||
set { SetValue(MouseWheelZoomDeltaProperty, value); }
|
||||
}
|
||||
|
||||
private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
|
||||
private async void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
|
||||
{
|
||||
TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
|
||||
transformTranslation.X += e.Delta.Translation.X;
|
||||
transformTranslation.Y += e.Delta.Translation.Y;
|
||||
transformRotation += e.Delta.Rotation;
|
||||
transformScale *= e.Delta.Scale;
|
||||
|
||||
if (!transformPending)
|
||||
{
|
||||
transformPending = true;
|
||||
|
||||
await Dispatcher.RunAsync(CoreDispatcherPriority.Low,
|
||||
() => TransformMap(e.Position, transformTranslation, transformRotation, transformScale));
|
||||
|
||||
transformTranslation.X = 0d;
|
||||
transformTranslation.Y = 0d;
|
||||
transformRotation = 0d;
|
||||
transformScale = 1d;
|
||||
transformPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyCompany("Clemens Fischer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020 Clemens Fischer")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyVersion("5.2.0")]
|
||||
[assembly: AssemblyFileVersion("5.2.0")]
|
||||
[assembly: AssemblyVersion("5.2.1")]
|
||||
[assembly: AssemblyFileVersion("5.2.1")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue