コード例 #1
0
        public virtual Vector3 GetWorldBodyPosition()
        {
            Vector3 bodyPos = _bodyPosition;

            if (_parent != null)
            {
                bodyPos += _parent.GetWorldContentPosition();
            }
            if (_parent is ScrollPanel)
            {
                ScrollPanel scrollPanel = (ScrollPanel)_parent;
                bodyPos += new Vector3(scrollPanel.GetScrolledAmount());
            }
            return(bodyPos);
        }
コード例 #2
0
        public virtual Vector3 GetWorldContentPosition()
        {
            Vector3 contentPos = GetContentPosition();

            if (_parent != null)
            {
                contentPos += _parent.GetWorldContentPosition();
            }
            if (_parent is ScrollPanel)
            {
                ScrollPanel scrollPanel = (ScrollPanel)_parent;
                Vector3     scroll      = new Vector3(scrollPanel.GetScrolledAmount());
                contentPos += scroll;
            }
            return(contentPos);
        }
コード例 #3
0
        public ScrollBar(State state, ScrollPanel parentPanel, SliderType sliderType)
            : base(0, 0, 1, 1, state)
        {
            _scrollPanel      = parentPanel;
            _sliderType       = sliderType;
            _scrollableAmount = 0;

            _sliderPosition = Vector3.Zero;

            _sliderInitialized = false;

            this.SetPosition(GetBodyX(), GetBodyY());
            this.SetSize(GetBodyWidth(), GetBodyHeight());

            _grabbed          = false;
            _backgroundColour = Color4.SlateGray;
        }
コード例 #4
0
        public virtual int GetMaxY()
        {
            Vector2 resolution = Renderer.GetResoultion();

            if (_parent == null)
            {
                return((int)resolution.Y - (int)_bodySize.Y);
            }
            else
            {
                if (_parent is ScrollPanel)
                {
                    ScrollPanel scrollPanel = (ScrollPanel)_parent;
                    return((int)(scrollPanel.GetScrollableDimensions().Y - _bodySize.Y));
                }
                else
                {
                    return(_parent.GetContentHeight() - (int)_bodySize.Y);
                }
            }
        }