public override Actor Hit(float x, float y, bool touchable) { if (touchable && Touchable == Scene2D.Touchable.Disabled) { return(null); } for (int i = Children.Count - 1; i >= 0; i--) { Actor child = Children[i]; if (!child.IsVisible) { continue; } Vector2 point = child.ParentToLocalCoordinates(new Vector2(x, y)); Actor hit = child.Hit(point.X, point.Y, touchable); if (hit != null) { return(hit); } } return(base.Hit(x, y, touchable)); }
public Vector2 LocalToDescendantCoordinates(Actor descendant, Vector2 localCoords) { if (Parent == null) { throw new ArgumentException("Child is not a descendant: " + descendant); } if (Parent != this) { localCoords = LocalToDescendantCoordinates(Parent, localCoords); } return(descendant.ParentToLocalCoordinates(localCoords)); }
public Vector2 LocalToDescendantCoordinates(Actor descendant, Vector2 localCoords) { if (Parent == null) throw new ArgumentException("Child is not a descendant: " + descendant); if (Parent != this) localCoords = LocalToDescendantCoordinates(Parent, localCoords); return descendant.ParentToLocalCoordinates(localCoords); }