Version 4.7.0: Fixed UWP MapBase.CenterPoint

This commit is contained in:
ClemensFischer 2018-03-11 21:03:44 +01:00
parent 05cf3e7d3d
commit 9566c2d708
3 changed files with 20 additions and 6 deletions

View file

@ -63,10 +63,6 @@ namespace MapControl
nameof(TileFadeDuration), typeof(TimeSpan), typeof(MapBase),
new PropertyMetadata(Tile.FadeDuration, (o, e) => Tile.FadeDuration = (TimeSpan)e.NewValue));
internal static readonly DependencyProperty CenterPointProperty = DependencyProperty.Register(
"CenterPoint", typeof(Point), typeof(MapBase),
new PropertyMetadata(new Point(), (o, e) => ((MapBase)o).CenterPointPropertyChanged((Point)e.NewValue)));
private PointAnimation centerAnimation;
private DoubleAnimation zoomLevelAnimation;
private DoubleAnimation headingAnimation;
@ -497,11 +493,11 @@ namespace MapControl
}
}
private void CenterPointPropertyChanged(Point centerPoint)
private void CenterPointPropertyChanged(Location center)
{
if (centerAnimation != null)
{
SetValueInternal(CenterProperty, new Location(centerPoint.Y, centerPoint.X));
SetValueInternal(CenterProperty, center);
UpdateTransform();
}
}

View file

@ -39,6 +39,10 @@ namespace MapControl
nameof(TargetHeading), typeof(double), typeof(MapBase),
new PropertyMetadata(0d, (o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue)));
internal static readonly DependencyProperty CenterPointProperty = DependencyProperty.Register(
"CenterPoint", typeof(Windows.Foundation.Point), typeof(MapBase),
new PropertyMetadata(new Windows.Foundation.Point(), (o, e) => ((MapBase)o).CenterPointPropertyChanged((Windows.Foundation.Point)e.NewValue)));
public MapBase()
{
MapProjection = new WebMercatorProjection();
@ -61,5 +65,10 @@ namespace MapControl
UpdateTransform();
};
}
private void CenterPointPropertyChanged(Windows.Foundation.Point center)
{
CenterPointPropertyChanged(new Location(center.Y, center.X));
}
}
}

View file

@ -43,6 +43,10 @@ namespace MapControl
0d, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
(o, e) => ((MapBase)o).TargetHeadingPropertyChanged((double)e.NewValue)));
private static readonly DependencyProperty CenterPointProperty = DependencyProperty.Register(
"CenterPoint", typeof(Point), typeof(MapBase),
new PropertyMetadata(new Point(), (o, e) => ((MapBase)o).CenterPointPropertyChanged((Point)e.NewValue)));
static MapBase()
{
ClipToBoundsProperty.OverrideMetadata(typeof(MapBase), new FrameworkPropertyMetadata(true));
@ -63,5 +67,10 @@ namespace MapControl
ResetTransformCenter();
UpdateTransform();
}
private void CenterPointPropertyChanged(Point center)
{
CenterPointPropertyChanged(new Location(center.Y, center.X));
}
}
}