Fixed MapOverlay.IsHitTestVisible

This commit is contained in:
ClemensF 2020-09-04 16:56:57 +02:00
parent 547bb7fc54
commit 7842a776a6
4 changed files with 12 additions and 35 deletions

View file

@ -2,8 +2,6 @@
// © 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;
@ -17,11 +15,6 @@ 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
@ -43,26 +36,9 @@ namespace MapControl
set { SetValue(MouseWheelZoomDeltaProperty, value); }
}
private async void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
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;
}
TransformMap(e.Position, e.Delta.Translation, e.Delta.Rotation, e.Delta.Scale);
}
private void OnPointerWheelChanged(object sender, PointerRoutedEventArgs e)

View file

@ -56,6 +56,11 @@ namespace MapControl
public static readonly DependencyProperty StrokeMiterLimitProperty = DependencyProperty.Register(
nameof(StrokeMiterLimit), typeof(double), typeof(MapOverlay), new PropertyMetadata(1d));
public MapOverlay()
{
IsHitTestVisible = false;
}
protected override void SetParentMap(MapBase map)
{
if (map != null)

View file

@ -56,6 +56,11 @@ namespace MapControl
public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner(
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
static MapOverlay()
{
IsHitTestVisibleProperty.OverrideMetadata(typeof(MapOverlay), new FrameworkPropertyMetadata(false));
}
public MapOverlay()
{
// Set Stroke Binding in a Loaded handler to allow Stroke value from a Style Setter.

View file

@ -130,15 +130,6 @@
<map:MapItemsControl ItemsSource="{Binding Pushpins}"
ItemContainerStyle="{StaticResource PushpinItemStyle}"/>
<map:MapPath Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
<map:MapPath.Location>
<map:Location Latitude="53.5" Longitude="8.2"/>
</map:MapPath.Location>
<map:MapPath.Data>
<EllipseGeometry RadiusX="1852" RadiusY="1852"/>
</map:MapPath.Data>
</map:MapPath>
<map:Pushpin Background="Yellow" Foreground="Blue" Content="N 53° 30' E 8° 12'">
<map:MapPanel.Location>
<map:Location Latitude="53.5" Longitude="8.2"/>