SetMargins() public method

Sets the margins to the specified values.
public SetMargins ( Vector2 marg ) : void
marg Vector2 The distance, in local units, in from the edges of /// the control where the text within should be clipped.
return void
Exemplo n.º 1
0
    // Returns true if any of the settings do not match:
    public override bool DidChange(SpriteRoot s)
    {
        UITextField tf = (UITextField)s;

        if (margins.x != tf.margins.x ||
            margins.y != tf.margins.y ||
            width != tf.width ||
            height != tf.height)
        {
            tf.SetMargins(tf.margins);
            tf.CalcClippingRect();
            margins = tf.margins;
            // Keep it to ourselves since we handled it
            //return true;
        }
        if (multiline != tf.multiline)
        {
            if (tf.spriteText != null)
            {
                tf.spriteText.multiline = tf.multiline;
            }
            return(true);
        }

        return(base.DidChange(s));
    }
    public override bool DidChange(SpriteRoot s)
    {
        UITextField uITextField = (UITextField)s;

        if (this.margins.x != uITextField.margins.x || this.margins.y != uITextField.margins.y || this.width != uITextField.width || this.height != uITextField.height)
        {
            uITextField.SetMargins(uITextField.margins);
            uITextField.CalcClippingRect();
            this.margins = uITextField.margins;
        }
        if (this.multiline != uITextField.multiline)
        {
            if (uITextField.spriteText != null)
            {
                uITextField.spriteText.multiline = uITextField.multiline;
            }
            return(true);
        }
        return(base.DidChange(s));
    }