public TextBox(Vector3 position, Vector2 size, TextBoxOptions opts) : base(position, size, opts) { _opts = opts; _clip = new Rect( opts.Border.x, opts.Border.y, size.x - opts.Border.x - opts.Border.z, size.y - opts.Border.y - opts.Border.w ); var clip = this.GetClipRect(); _text = new Label( new Rect(clip.x, clip.y, clip.width * 1000f, clip.height), position.z - 0.1f, "", new LabelOptions { Font = opts.Font, VerticalAlignment = VerticalAlignment.Center, Name = "text", Parent = this, IsHitTestable = true }); _caret = new Image( _text.Position + new Vector3(0f, (_text.Size.y - opts.CaretSize.y) / 2f, -0.1f), opts.CaretSize, opts.CaretSprite, new VisualOptions { Name = "caret", Parent = this, PixelAlign = false }); _caret.SetActive(false); _cursor = opts.Cursor; }
public TextBox(Rect bounds, float depth, TextBoxOptions opts) : this(new Vector3(bounds.x, bounds.y, depth), new Vector2(bounds.width, bounds.height), opts) { }