/// <summary> /// This is a scrubbing call when an element is being deleted. /// In case it has focus, make sure that power is handed down gracefully. /// /// Awkward power voids where a de-referenced element has focus is awkward. /// I know. Trust me. /// </summary> /// <param name="element">The element that is losing focus (if it actually has focus)</param> public void RemoveFocus(ScreenElement element) { if (element.Equals(this.screenFocus)) { var parent = this.screenFocus.Parent; this.screenFocus.UnClicked(parent); this.screenFocus = parent; if (parent != null) { parent.Clicked(Input.MousePosition, LeftOrRight.Neither); } } }