From 3548435e6f86b0bf019be2dbdd32240e255f4c6a Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Wed, 4 Feb 2026 23:00:42 +0100 Subject: [PATCH] Fixed MapItem.MapTransform property --- MapControl/Shared/MapItem.cs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/MapControl/Shared/MapItem.cs b/MapControl/Shared/MapItem.cs index 48e17f50..ff0bd387 100644 --- a/MapControl/Shared/MapItem.cs +++ b/MapControl/Shared/MapItem.cs @@ -63,12 +63,11 @@ namespace MapControl field = value; - if (field != null && MapTransform != null) + if (field != null && mapTransform != null) { // Attach ViewportChanged handler only if MapTransform is actually used. // field.ViewportChanged += OnViewportChanged; - UpdateMapTransform(); } } @@ -82,9 +81,9 @@ namespace MapControl { get { - if (field == null) + if (mapTransform == null) { - field = new MatrixTransform(); + mapTransform = new MatrixTransform(); if (ParentMap != null) { @@ -94,7 +93,17 @@ namespace MapControl } } - return field; + return mapTransform; + } + } + + private MatrixTransform mapTransform; + + private void UpdateMapTransform() + { + if (mapTransform != null && ParentMap != null && Location != null) + { + mapTransform.Matrix = ParentMap.GetMapToViewTransform(Location); } } @@ -102,13 +111,5 @@ namespace MapControl { UpdateMapTransform(); } - - private void UpdateMapTransform() - { - if (MapTransform != null && ParentMap != null && Location != null) - { - MapTransform.Matrix = ParentMap.GetMapToViewTransform(Location); - } - } } }