mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-03-30 18:15:26 +02:00
Set AffectsRender flag on MapPanel.ViewportPosition property, fixed Map.ZoomMap method.
This commit is contained in:
parent
5760471c1c
commit
e8b29be79e
|
|
@ -405,6 +405,7 @@ namespace MapControl
|
||||||
UpdateTransform();
|
UpdateTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResetTransformOrigin();
|
||||||
TranslateMap(translation);
|
TranslateMap(translation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -414,8 +415,13 @@ namespace MapControl
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ZoomMap(Point origin, double zoomLevel)
|
public void ZoomMap(Point origin, double zoomLevel)
|
||||||
{
|
{
|
||||||
SetTransformOrigin(origin);
|
double targetZoomLebel = TargetZoomLevel;
|
||||||
TargetZoomLevel = zoomLevel;
|
TargetZoomLevel = zoomLevel;
|
||||||
|
|
||||||
|
if (TargetZoomLevel != targetZoomLebel) // TargetZoomLevel might be coerced
|
||||||
|
{
|
||||||
|
SetTransformOrigin(origin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace MapControl
|
||||||
|
|
||||||
private static readonly DependencyPropertyKey ViewportPositionPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
|
private static readonly DependencyPropertyKey ViewportPositionPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
|
||||||
"ViewportPosition", typeof(Point?), typeof(MapPanel),
|
"ViewportPosition", typeof(Point?), typeof(MapPanel),
|
||||||
new FrameworkPropertyMetadata(ViewportPositionPropertyChanged));
|
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, ViewportPositionPropertyChanged));
|
||||||
|
|
||||||
public static readonly DependencyProperty ViewportPositionProperty = ViewportPositionPropertyKey.DependencyProperty;
|
public static readonly DependencyProperty ViewportPositionProperty = ViewportPositionPropertyKey.DependencyProperty;
|
||||||
|
|
||||||
|
|
@ -93,15 +93,13 @@ namespace MapControl
|
||||||
|
|
||||||
protected virtual void OnViewportChanged()
|
protected virtual void OnViewportChanged()
|
||||||
{
|
{
|
||||||
Map parentMap = ParentMap;
|
|
||||||
|
|
||||||
foreach (UIElement element in InternalChildren)
|
foreach (UIElement element in InternalChildren)
|
||||||
{
|
{
|
||||||
Location location = GetLocation(element);
|
Location location = GetLocation(element);
|
||||||
|
|
||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
SetViewportPosition(element, parentMap, location);
|
SetViewportPosition(element, ParentMap, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue