ParentToLocalCoordinates() публичный Метод

public ParentToLocalCoordinates ( Vector2 parentCoords ) : Vector2
parentCoords Vector2
Результат 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
        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);
        }