Implement updateHighlighted method

This commit is contained in:
Andrei Zavatski 2019-11-21 19:02:24 +03:00
parent 984ec11a78
commit 23fc7b1987
1 changed files with 17 additions and 7 deletions

View File

@ -64,24 +64,34 @@ private void selectionChanged(Mod mod, bool selected)
else
SelectedMods.Remove(mod);
if (!SelectedMods.Any() && !IsHovered)
updateHighlighted();
}
private void updateHighlighted()
{
if (SelectedMods.Any())
return;
if (IsHovered)
{
modsContainer.Children.Where(button => !button.IsHovered).ForEach(button => button.Highlighted.Value = false);
}
else
{
highlightAll();
}
}
protected override bool OnHover(HoverEvent e)
{
if (!SelectedMods.Any())
modsContainer.Children.Where(button => !button.IsHovered).ForEach(button => button.Highlighted.Value = false);
updateHighlighted();
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
if (!SelectedMods.Any())
highlightAll();
updateHighlighted();
}
public void DeselectAll() => modsContainer.ForEach(mod => mod.Selected.Value = false);