Debug Tools: moved DebugStartItemPicker() to public API. Added to Demo->Tools menu. (#2673)

This commit is contained in:
ocornut
2024-02-20 17:31:25 +01:00
parent 198c38f0b1
commit 659fb41d0a
5 changed files with 18 additions and 2 deletions

View File

@ -15462,6 +15462,12 @@ void ImGui::DebugLocateItemResolveWithLastItem()
draw_list->AddLine(p1, p2, DEBUG_LOCATE_ITEM_COLOR);
}
void ImGui::DebugStartItemPicker()
{
ImGuiContext& g = *GImGui;
g.DebugItemPickerActive = true;
}
// [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack.
void ImGui::UpdateDebugToolItemPicker()
{
@ -15630,7 +15636,7 @@ void ImGui::ShowIDStackToolWindow(bool* p_open)
Checkbox("Ctrl+C: copy path to clipboard", &tool->CopyToClipboardOnCtrlC);
SameLine();
TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*");
if (tool->CopyToClipboardOnCtrlC && IsKeyDown(ImGuiMod_Ctrl) && IsKeyPressed(ImGuiKey_C))
if (tool->CopyToClipboardOnCtrlC && Shortcut(ImGuiMod_Ctrl | ImGuiKey_C, 0, ImGuiInputFlags_RouteGlobal))
{
tool->CopyToClipboardLastTime = (float)g.Time;
char* p = g.TempBuffer.Data;
@ -15697,6 +15703,7 @@ void ImGui::DebugLog(const char*, ...) {}
void ImGui::DebugLogV(const char*, va_list) {}
void ImGui::ShowDebugLogWindow(bool*) {}
void ImGui::ShowIDStackToolWindow(bool*) {}
void ImGui::DebugStartItemPicker() {}
void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {}
#endif // #ifndef IMGUI_DISABLE_DEBUG_TOOLS