FairyGUI.GObject.SetSize C# (CSharp) Method

SetSize() public method

Change size.
public SetSize ( float wv, float hv, bool ignorePivot ) : void
wv float Width value.
hv float Height value.
ignorePivot bool If pivot is set, the object's positon will change when its size change. Set ignorePivot=false to keep the position.
return void
        public void SetSize(float wv, float hv, bool ignorePivot)
        {
            if (_rawWidth != wv || _rawHeight != hv)
            {
                _rawWidth = wv;
                _rawHeight = hv;
                if (wv < 0)
                    wv = 0;
                if (hv < 0)
                    hv = 0;
                float oldWidth = _width;
                float oldHeight = _height;
                _width = wv;
                _height = hv;

                HandleSizeChanged();

                if (_pivotX != 0 || _pivotY != 0)
                {
                    if (!_pivotAsAnchor)
                    {
                        if (!ignorePivot)
                            this.SetXY(_x - _pivotX * (_width - oldWidth), _y - _pivotY * (_height - oldHeight));
                        else
                            this.HandlePositionChanged();
                    }
                    else
                        this.HandlePositionChanged();
                }

                UpdateGear(2);

                if (parent != null)
                {
                    relations.OnOwnerSizeChanged(_width - oldWidth, _height - oldHeight);
                    parent.SetBoundsChangedFlag();
                }

                onSizeChanged.Call();
            }
        }

Same methods

GObject::SetSize ( float wv, float hv ) : void

Usage Example

Example #1
0
 virtual protected void LayoutModalWaitPane()
 {
     if (_contentArea != null)
     {
         Vector2 pt = _frame.LocalToGlobal(Vector2.zero);
         pt = this.GlobalToLocal(pt);
         _modalWaitPane.SetXY((int)pt.x + _contentArea.x, (int)pt.y + _contentArea.y);
         _modalWaitPane.SetSize(_contentArea.width, _contentArea.height);
     }
     else
     {
         _modalWaitPane.SetSize(this.width, this.height);
     }
 }
All Usage Examples Of FairyGUI.GObject::SetSize