mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Fixed IsItemDeactivated()/IsItemDeactivatedAfterEdit() from not correctly returning true when tabbing out of a focusable widget (Input/Slider/Drag) in most situations. (#2215, #1875)
+ Minor renaming of a local variable in widget code.
This commit is contained in:
@ -1950,14 +1950,14 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, floa
|
||||
|
||||
// Tabbing or CTRL-clicking on Drag turns it into an input box
|
||||
bool start_text_input = false;
|
||||
const bool tab_focus_requested = FocusableItemRegister(window, id);
|
||||
if (tab_focus_requested || (hovered && (g.IO.MouseClicked[0] || g.IO.MouseDoubleClicked[0])) || g.NavActivateId == id || (g.NavInputId == id && g.ScalarAsInputTextId != id))
|
||||
const bool focus_requested = FocusableItemRegister(window, id);
|
||||
if (focus_requested || (hovered && (g.IO.MouseClicked[0] || g.IO.MouseDoubleClicked[0])) || g.NavActivateId == id || (g.NavInputId == id && g.ScalarAsInputTextId != id))
|
||||
{
|
||||
SetActiveID(id, window);
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
if (tab_focus_requested || g.IO.KeyCtrl || g.IO.MouseDoubleClicked[0] || g.NavInputId == id)
|
||||
if (focus_requested || g.IO.KeyCtrl || g.IO.MouseDoubleClicked[0] || g.NavInputId == id)
|
||||
{
|
||||
start_text_input = true;
|
||||
g.ScalarAsInputTextId = 0;
|
||||
@ -2385,15 +2385,15 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* v, co
|
||||
|
||||
// Tabbing or CTRL-clicking on Slider turns it into an input box
|
||||
bool start_text_input = false;
|
||||
const bool tab_focus_requested = FocusableItemRegister(window, id);
|
||||
const bool focus_requested = FocusableItemRegister(window, id);
|
||||
const bool hovered = ItemHoverable(frame_bb, id);
|
||||
if (tab_focus_requested || (hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || (g.NavInputId == id && g.ScalarAsInputTextId != id))
|
||||
if (focus_requested || (hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || (g.NavInputId == id && g.ScalarAsInputTextId != id))
|
||||
{
|
||||
SetActiveID(id, window);
|
||||
SetFocusID(id, window);
|
||||
FocusWindow(window);
|
||||
g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down);
|
||||
if (tab_focus_requested || g.IO.KeyCtrl || g.NavInputId == id)
|
||||
if (focus_requested || g.IO.KeyCtrl || g.NavInputId == id)
|
||||
{
|
||||
start_text_input = true;
|
||||
g.ScalarAsInputTextId = 0;
|
||||
|
Reference in New Issue
Block a user