ParentToLocalCoordinates() public method

public ParentToLocalCoordinates ( Vector2 parentCoords ) : Vector2
parentCoords Vector2
return Vector2
Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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);
        }