ParentToLocalCoordinates() public method

public ParentToLocalCoordinates ( Vector2 parentCoords ) : Vector2
parentCoords Vector2
return Vector2
示例#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));
        }
示例#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));
        }
示例#3
0
文件: Group.cs 项目: jaquadro/MonoGdx
        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);
        }