mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Handle frozen Data in WPF MapPath
This commit is contained in:
parent
14c26b34e8
commit
2652e5eb0f
|
|
@ -68,9 +68,16 @@ namespace MapControl
|
||||||
|
|
||||||
protected virtual void UpdateData()
|
protected virtual void UpdateData()
|
||||||
{
|
{
|
||||||
|
#if !WINUI && !UWP
|
||||||
|
if (Data != null && Data.IsFrozen)
|
||||||
|
{
|
||||||
|
Data = Data.Clone();
|
||||||
|
return; // UpdateData called again from DataPropertyChanged callback
|
||||||
|
}
|
||||||
|
#endif
|
||||||
MapPanel.SetLocation(this, Location);
|
MapPanel.SetLocation(this, Location);
|
||||||
|
|
||||||
if (parentMap != null && Data != null && Location != null)
|
if (parentMap != null && Location != null && Data != null)
|
||||||
{
|
{
|
||||||
var scale = parentMap.GetScale(Location);
|
var scale = parentMap.GetScale(Location);
|
||||||
var transform = new Matrix(scale.X, 0d, 0d, scale.Y, 0d, 0d);
|
var transform = new Matrix(scale.X, 0d, 0d, scale.Y, 0d, 0d);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,15 @@ namespace MapControl
|
||||||
{
|
{
|
||||||
public partial class MapPath : Shape, IWeakEventListener
|
public partial class MapPath : Shape, IWeakEventListener
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty DataProperty = Path.DataProperty.AddOwner(typeof(MapPath));
|
public static readonly DependencyProperty DataProperty = Path.DataProperty.AddOwner(
|
||||||
|
typeof(MapPath), new PropertyMetadata(null,
|
||||||
|
(o, e) =>
|
||||||
|
{
|
||||||
|
if (e.NewValue != e.OldValue) // Data is actually a new Geometry
|
||||||
|
{
|
||||||
|
((MapPath)o).UpdateData();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
public Geometry Data
|
public Geometry Data
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue