Avoid null by calling initial OnDeselected later

This commit is contained in:
Dean Herbert 2020-01-21 17:36:21 +09:00
parent 195068ba9a
commit 24a466ab24
1 changed files with 8 additions and 2 deletions

View File

@ -40,11 +40,15 @@ public abstract class SelectionBlueprint : CompositeDrawable, IStateful<Selectio
protected SelectionBlueprint(HitObject hitObject)
{
this.HitObject = hitObject;
HitObject = hitObject;
RelativeSizeAxes = Axes.Both;
}
AlwaysPresent = true;
[BackgroundDependencyLoader]
private void load()
{
OnDeselected();
AlwaysPresent = true;
}
private SelectionState state;
@ -116,5 +120,7 @@ public SelectionState State
/// The screen-space quad that outlines this <see cref="OverlaySelectionBlueprint"/> for selections.
/// </summary>
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
public Vector2 GetInstantDelta(Vector2 screenSpacePosition) => Parent.ToLocalSpace(screenSpacePosition) - Position;
}
}