Implement instant movement properly

This commit is contained in:
iiSaLMaN 2019-09-01 06:07:25 +03:00
parent 7d955839be
commit a155814bc4
1 changed files with 17 additions and 2 deletions

View File

@ -283,9 +283,24 @@ public bool SetContent(object content)
return true;
}
public void Move(Vector2 pos) => Position = pos;
private bool instantMove = true;
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
public void Move(Vector2 pos)
{
if (instantMove)
{
Position = pos;
instantMove = false;
}
else
this.MoveTo(pos, 200, Easing.OutQuint);
}
protected override void PopIn()
{
instantMove |= !IsPresent;
this.FadeIn(200, Easing.OutQuint);
}
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
}