Simplified Tile class

This commit is contained in:
ClemensFischer 2023-08-21 20:48:51 +02:00
parent 7b404446d2
commit 7d78d2587e
4 changed files with 13 additions and 14 deletions

View file

@ -40,26 +40,22 @@ namespace MapControl
public Image Image { get; } = new Image
{
Opacity = 0d,
Stretch = Stretch.Fill,
IsHitTestVisible = false // avoid touch capture issues
};
public bool IsPending { get; set; } = true;
public void SetImageSource(ImageSource image, bool animateOpacity = true)
public void SetImageSource(ImageSource image)
{
IsPending = false;
Image.Source = image;
if (image != null && animateOpacity && MapBase.ImageFadeDuration > TimeSpan.Zero)
if (image != null && MapBase.ImageFadeDuration > TimeSpan.Zero)
{
AnimateImageOpacity();
}
else
{
Image.Opacity = 1d;
AnimateImageOpacity(image);
}
Image.Source = image;
}
private void BeginOpacityAnimation()

View file

@ -25,7 +25,8 @@ namespace MapControl
if (equivalentTile != null)
{
tile.SetImageSource(equivalentTile.Image.Source, false); // no opacity animation
tile.IsPending = false;
tile.Image.Source = equivalentTile.Image.Source; // no opacity animation
}
}