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. Enter keep the input active and select all text.
- InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E) - InputText: numerical fields automatically accept full-width characters (U+FF01..U+FF5E)
by converting them to half-width (U+0021..U+007E). 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, - IsItemHovered: Added ImGuiHoveredFlags_DelayNormal and ImGuiHoveredFlags_DelayShort flags,
allowing to introduce a shared delay for tooltip idioms. The delays are respectively 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) 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 // 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) // (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 "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_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
#define IMGUI_HAS_TABLE #define IMGUI_HAS_TABLE

View File

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