Better handle OnClick

This commit is contained in:
Dean Herbert 2019-06-04 10:26:21 +09:00
parent d5a2ebf79f
commit e8315085c0
1 changed files with 11 additions and 7 deletions

View File

@ -108,14 +108,18 @@ private void load(OsuColour colors)
protected override bool OnClick(ClickEvent e)
{
var clickResult = base.OnClick(e);
if (!Enabled.Value)
return false;
if (IsLoading)
return clickResult;
IsLoading |= clickResult;
return clickResult;
try
{
return base.OnClick(e);
}
finally
{
// run afterwards as this will disable this button.
IsLoading = true;
}
}
private class ChevronIcon : SpriteIcon