Ejemplo n.º 1
0
        public Vector2 GetPosition(IGuiElement element)
        {
            Vector2 topLeftPosition = mFixedPosition;

            // Translate for Local Anchor
            topLeftPosition -= mLocalAnchor.OffsetFromTopLeft(element.ExternalSize);

            // Translate for Parent Anchor
            Vector2 parentSize = Vector2.zero;

            if (element.Parent != null)
            {
                // Parent Space
                parentSize = element.Parent.Size;
            }
            else
            {
                // Screen Space
                parentSize = new Vector2(Screen.width, Screen.height);
            }

            topLeftPosition += mParentAnchor.OffsetFromTopLeft(parentSize);

            return(topLeftPosition);
        }
Ejemplo n.º 2
0
        public Vector2 GetPosition(IGuiElement e)
        {
            Vector2 result = mCurrentPosition;

            if (mAnchor != null)
            {
                result -= mAnchor.OffsetFromTopLeft(e.ExternalSize);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public Vector2 GetPosition(IGuiElement e)
        {
            Vector2 result = Vector2.zero;

            if (!mDisposed)
            {
                Vector3 position = mCamera.WorldToScreenPoint(mTransform.position + mWorldSpaceOffset);
                result = new Vector2(position.x + mOffset.x, (Screen.height - position.y) + mOffset.y);
                if (mAnchor != null)
                {
                    result -= mAnchor.OffsetFromTopLeft(e.ExternalSize);
                }
            }
            return(result);
        }