Updated MapPath

This commit is contained in:
ClemensFischer 2025-12-13 18:40:09 +01:00
parent b1d0db8762
commit d0a895d306
2 changed files with 13 additions and 13 deletions

View file

@ -70,7 +70,7 @@ namespace MapControl
{
if (parentMap != null && Location != null && Data != null)
{
SetMapTransform(parentMap.GetMapTransform(Location));
SetDataTransform(parentMap.GetMapTransform(Location));
}
MapPanel.SetLocation(this, Location);

View file

@ -18,6 +18,18 @@ namespace MapControl
protected override Geometry DefiningGeometry => Data;
protected void SetDataTransform(Matrix matrix)
{
if (Data.Transform is MatrixTransform transform && !transform.IsFrozen)
{
transform.Matrix = matrix;
}
else
{
Data.Transform = new MatrixTransform(matrix);
}
}
private void DataPropertyChanged(DependencyPropertyChangedEventArgs e)
{
// Check if Data is actually a new Geometry.
@ -36,17 +48,5 @@ namespace MapControl
}
}
}
private void SetMapTransform(Matrix matrix)
{
if (Data.Transform is MatrixTransform transform && !transform.IsFrozen)
{
transform.Matrix = matrix;
}
else
{
Data.Transform = new MatrixTransform(matrix);
}
}
}
}