stb_textedit: better support for keying while holding mouse drag button

pull/209/head
ocornut 2015-12-11 22:55:42 +00:00
parent 64fa9a3d95
commit 9dc860b7cc
1 changed files with 2 additions and 0 deletions

View File

@ -451,6 +451,8 @@ static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *stat
static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)
{
int p = stb_text_locate_coord(str, x, y);
if (state->select_start == state->select_end)
state->select_start = state->cursor;
state->cursor = state->select_end = p;
}