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); }
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); }
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; }
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); } } }