diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index 8b5ab5c1..824fbe78 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -204,15 +204,12 @@ namespace MapControl base.OnViewportChanged(e); - if (updateTimer.IsEnabled && !UpdateWhileViewportChanging) + if (!UpdateWhileViewportChanging) { updateTimer.Stop(); // restart } - if (!updateTimer.IsEnabled) - { - updateTimer.Start(); - } + updateTimer.Start(); } } diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index 1f97e7e5..2a55526d 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -82,29 +82,30 @@ namespace MapControl protected override void UpdateTileLayer(bool tileSourceChanged) { - var update = false; + var updateTiles = false; if (ParentMap == null || !ParentMap.MapProjection.IsWebMercator) { + Tiles.Clear(); TileMatrix = null; - update = true; + updateTiles = true; } else { if (tileSourceChanged) { Tiles.Clear(); - update = true; + updateTiles = true; } if (SetTileMatrix()) { SetRenderTransform(); - update = true; + updateTiles = true; } } - if (update) + if (updateTiles) { UpdateTiles(); } @@ -154,10 +155,9 @@ namespace MapControl private void UpdateTiles() { - var newTiles = new List(); - if (ParentMap != null && TileMatrix != null && TileSource != null) { + var newTiles = new List(); var maxZoomLevel = Math.Min(TileMatrix.ZoomLevel, MaxZoomLevel); if (maxZoomLevel >= MinZoomLevel) @@ -201,9 +201,9 @@ namespace MapControl } } } - } - Tiles = newTiles; + Tiles = newTiles; + } Children.Clear(); diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index dd5766ca..ec0d4f13 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -170,15 +170,12 @@ namespace MapControl { SetRenderTransform(); - if (updateTimer.IsEnabled && !UpdateWhileViewportChanging) + if (!UpdateWhileViewportChanging) { updateTimer.Stop(); // restart } - if (!updateTimer.IsEnabled) - { - updateTimer.Start(); - } + updateTimer.Start(); } }