ImGui::InputText: added support for shift+click style selection. (#5619)

(Amend, force-push: sorry wrong edit by omar)
This commit is contained in:
Constantine Tarasenkov 2022-08-28 20:12:44 +03:00 committed by ocornut
parent fe62927bd8
commit b87e58fab3
3 changed files with 6 additions and 3 deletions

View File

@ -86,6 +86,7 @@ Other Changes:
Enter keep the input active and select all text.
- InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E)
by converting them to half-width (U+0021..U+007E).
- InputText: added support for shift+click style selection. (#5619) [@procedural]
- IsItemHovered: Added ImGuiHoveredFlags_DelayNormal and ImGuiHoveredFlags_DelayShort flags,
allowing to introduce a shared delay for tooltip idioms. The delays are respectively
io.HoverDelayNormal (default to 0.30f) and io.HoverDelayFast (default to 0.10f). (#1485)

View File

@ -65,7 +65,7 @@ Index of this file:
// Version
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
#define IMGUI_VERSION "1.89 WIP"
#define IMGUI_VERSION_NUM 18815
#define IMGUI_VERSION_NUM 18816
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE

View File

@ -4251,10 +4251,12 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
}
else if (io.MouseClicked[0] && !state->SelectedAllMouseLock)
{
// FIXME: unselect on late click could be done release?
if (hovered)
{
stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);
if (io.KeyShift)
stb_textedit_drag(state, &state->Stb, mouse_x, mouse_y);
else
stb_textedit_click(state, &state->Stb, mouse_x, mouse_y);
state->CursorAnimReset();
}
}