void SetSize(float aWidth, float aHeight)
{
AdjustMaskContainer();
if (_hzScrollBar != null)
{
_hzScrollBar.y = aHeight - _hzScrollBar.height;
if (_vtScrollBar != null)
{
_hzScrollBar.width = aWidth - _vtScrollBar.width - _scrollBarMargin.left - _scrollBarMargin.right;
if (_displayOnLeft)
_hzScrollBar.x = _scrollBarMargin.left + _vtScrollBar.width;
else
_hzScrollBar.x = _scrollBarMargin.left;
}
else
{
_hzScrollBar.width = aWidth - _scrollBarMargin.left - _scrollBarMargin.right;
_hzScrollBar.x = _scrollBarMargin.left;
}
}
if (_vtScrollBar != null)
{
if (!_displayOnLeft)
_vtScrollBar.x = aWidth - _vtScrollBar.width;
if (_hzScrollBar != null)
_vtScrollBar.height = aHeight - _hzScrollBar.height - _scrollBarMargin.top - _scrollBarMargin.bottom;
else
_vtScrollBar.height = aHeight - _scrollBarMargin.top - _scrollBarMargin.bottom;
_vtScrollBar.y = _scrollBarMargin.top;
}
_viewWidth = aWidth;
_viewHeight = aHeight;
if (_hzScrollBar != null && !_hScrollNone)
_viewHeight -= _hzScrollBar.height;
if (_vtScrollBar != null && !_vScrollNone)
_viewWidth -= _vtScrollBar.width;
_viewWidth -= (_owner.margin.left + _owner.margin.right);
_viewHeight -= (_owner.margin.top + _owner.margin.bottom);
_viewWidth = Mathf.Max(1, _viewWidth);
_viewHeight = Mathf.Max(1, _viewHeight);
_pageSize = new Vector2(_viewWidth, _viewHeight);
HandleSizeChanged();
}