Skip to content

UITextInput.HitTestCharacterIndex(IRenderer, float, string) Method

Definition

Namespace: Brine2D.UI

Returns the character index closest to screenX given the current scroll offset. Used to position the cursor on mouse click or drag. displayText should be Brine2D.UI.UITextInput.GetDisplayText so that password-masked fields are measured correctly. Widths are accumulated incrementally \(O\(n\) measurements instead of O\(n²\)).

C#
private int HitTestCharacterIndex(Brine2D.Rendering.IRenderer renderer, float screenX, string displayText);

Parameters

renderer IRenderer

screenX System.Single

displayText System.String

Returns

System.Int32