Updated MapTileLayer

This commit is contained in:
ClemensF 2020-10-27 23:34:14 +01:00
parent 6435ee462a
commit 8eb3c072f5
3 changed files with 13 additions and 19 deletions

View file

@ -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();
}
}

View file

@ -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<Tile>();
if (ParentMap != null && TileMatrix != null && TileSource != null)
{
var newTiles = new List<Tile>();
var maxZoomLevel = Math.Min(TileMatrix.ZoomLevel, MaxZoomLevel);
if (maxZoomLevel >= MinZoomLevel)
@ -201,9 +201,9 @@ namespace MapControl
}
}
}
}
Tiles = newTiles;
Tiles = newTiles;
}
Children.Clear();

View file

@ -170,15 +170,12 @@ namespace MapControl
{
SetRenderTransform();
if (updateTimer.IsEnabled && !UpdateWhileViewportChanging)
if (!UpdateWhileViewportChanging)
{
updateTimer.Stop(); // restart
}
if (!updateTimer.IsEnabled)
{
updateTimer.Start();
}
updateTimer.Start();
}
}