mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-06 04:58:47 +02:00
Tools: Item Picker: Mouse button can be changed by holding Ctrl+Shift. (#2673)
This commit is contained in:
14
imgui.cpp
14
imgui.cpp
@ -13229,16 +13229,24 @@ void ImGui::UpdateDebugToolItemPicker()
|
||||
SetMouseCursor(ImGuiMouseCursor_Hand);
|
||||
if (IsKeyPressed(ImGuiKey_Escape))
|
||||
g.DebugItemPickerActive = false;
|
||||
if (IsMouseClicked(0) && hovered_id)
|
||||
const bool change_mapping = g.IO.KeyMods == (ImGuiModFlags_Ctrl | ImGuiModFlags_Shift);
|
||||
if (!change_mapping && IsMouseClicked(g.DebugItemPickerMouseButton) && hovered_id)
|
||||
{
|
||||
g.DebugItemPickerBreakId = hovered_id;
|
||||
g.DebugItemPickerActive = false;
|
||||
}
|
||||
SetNextWindowBgAlpha(0.60f);
|
||||
for (int mouse_button = 0; mouse_button < 3; mouse_button++)
|
||||
if (change_mapping && IsMouseClicked(mouse_button))
|
||||
g.DebugItemPickerMouseButton = (ImU8)mouse_button;
|
||||
SetNextWindowBgAlpha(0.70f);
|
||||
BeginTooltip();
|
||||
Text("HoveredId: 0x%08X", hovered_id);
|
||||
Text("Press ESC to abort picking.");
|
||||
TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click to break in debugger!");
|
||||
const char* mouse_button_names[] = { "Left", "Right", "Middle" };
|
||||
if (change_mapping)
|
||||
Text("Remap w/ Ctrl+Shift: click anywhere to select new mouse button.");
|
||||
else
|
||||
TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click %s Button to break in debugger! (remap w/ Ctrl+Shift)", mouse_button_names[g.DebugItemPickerMouseButton]);
|
||||
EndTooltip();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user