mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
39 lines
982 B
C#
39 lines
982 B
C#
using Avalonia.Controls.Shapes;
|
|
|
|
namespace MapControl
|
|
{
|
|
public partial class MapPath : Shape
|
|
{
|
|
public MapPath()
|
|
{
|
|
Stretch = Stretch.None;
|
|
}
|
|
|
|
public static readonly StyledProperty<Geometry> DataProperty =
|
|
DependencyPropertyHelper.AddOwner<MapPath, Geometry>(Path.DataProperty, null,
|
|
(path, oldValue, newValue) => path.UpdateData());
|
|
|
|
public Geometry Data
|
|
{
|
|
get => GetValue(DataProperty);
|
|
set => SetValue(DataProperty, value);
|
|
}
|
|
|
|
protected override Geometry CreateDefiningGeometry() => Data;
|
|
|
|
private void SetMapTransform(Matrix matrix)
|
|
{
|
|
if (Data.Transform is MatrixTransform transform)
|
|
{
|
|
transform.Matrix = matrix;
|
|
}
|
|
else
|
|
{
|
|
Data.Transform = new MatrixTransform(matrix);
|
|
}
|
|
|
|
InvalidateVisual();
|
|
}
|
|
}
|
|
}
|