mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00: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:
parent
26328fc9fe
commit
344140004b
@ -44,10 +44,12 @@ Other Changes:
|
||||
|
||||
- Added GetBackgroundDrawList() helper to quickly get access to a ImDrawList that will be rendered
|
||||
behind every other windows. (#2391)
|
||||
- Nav: Fixed a tap on AltGR (e.g. German keyboard) from navigating to the menu layer.
|
||||
- Nav: Fixed Ctrl+Tab keeping active InputText() of a previous window active after the switch. (#2380)
|
||||
- DragScalar, InputScalar, SliderScalar: Added support for u8/s8/u16/s16 data types.
|
||||
We are reusing function instances for larger types to reduce code size. (#643, #320, #708, #1011)
|
||||
- Nav: Fixed a tap on AltGR (e.g. German keyboard) from navigating to the menu layer.
|
||||
- Nav: Fixed Ctrl+Tab keeping active InputText() of a previous window active after the switch. (#2380)
|
||||
- Fixed IsItemDeactivated()/IsItemDeactivatedAfterEdit() from not correctly returning true
|
||||
when tabbing out of a focusable widget (Input/Slider/Drag) in most situations. (#2215, #1875)
|
||||
- InputInt, InputFloat, InputScalar: Fix to keep the label of the +/- buttons centered when
|
||||
style.FramePadding.x is abnormally larger than style.FramePadding.y. Since the buttons are
|
||||
meant to be square (to align with e.g. color button) we always use FramePadding.y. (#2367)
|
||||
|
@ -2891,6 +2891,7 @@ bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged
|
||||
return false;
|
||||
}
|
||||
|
||||
// Process TAB/Shift+TAB. Be mindful that this function may _clear_ the ActiveID when tabbing out.
|
||||
bool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@ -2919,6 +2920,10 @@ bool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id)
|
||||
g.NavJustTabbedId = id;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If another item is about to be focused, we clear our own active id
|
||||
if (g.ActiveId == id)
|
||||
ClearActiveID();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user