Added experimental io.ConfigDragClickToInputText feature to enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). (#3737)

+ Offset ImGuiTableColumnFlags values.
This commit is contained in:
ocornut
2021-01-20 19:16:45 +01:00
parent dc0f3d982c
commit 74b3b7cf58
4 changed files with 22 additions and 19 deletions

View File

@ -2295,17 +2295,15 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data,
FocusableItemUnregister(window);
}
}
#if 0
// Experimental: simple click (without moving) turns Drag into an InputText
// FIXME: Currently polling ImGuiConfigFlags_IsTouchScreen, may either poll an hypothetical ImGuiBackendFlags_HasKeyboard and/or an explicit drag settings.
if (temp_input_allowed && !temp_input_is_active && !(g.IO.ConfigFlags & ImGuiConfigFlags_IsTouchScreen))
if (g.IO.ConfigDragClickToInputText && temp_input_allowed && !temp_input_is_active)
if (g.ActiveId == id && hovered && g.IO.MouseReleased[0] && !IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR))
{
g.NavInputId = id;
temp_input_is_active = true;
FocusableItemUnregister(window);
}
#endif
}
if (temp_input_is_active)