mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Nav: Tabbing always enable nav highlight when ImGuiConfigFlags_NavEnableKeyboard is set. (#6802, #3092, #5759, #787)
This commit is contained in:
parent
0e1ce76ea8
commit
b9ab6e2019
@ -53,6 +53,9 @@ Breaking changes:
|
|||||||
|
|
||||||
Other changes:
|
Other changes:
|
||||||
|
|
||||||
|
- Nav: Tabbing always enable nav highlight when ImGuiConfigFlags_NavEnableKeyboard is set.
|
||||||
|
Previously was inconsistent and only enabled when stepping through a non-input item.
|
||||||
|
(#6802, #3092, #5759, #787)
|
||||||
- Fonts: 'float size_pixels' passed to AddFontXXX() functions is now rounded to lowest integer.
|
- Fonts: 'float size_pixels' passed to AddFontXXX() functions is now rounded to lowest integer.
|
||||||
This is because our layout/font system currently doesn't fully support non-integer sizes. Until
|
This is because our layout/font system currently doesn't fully support non-integer sizes. Until
|
||||||
it does, this has been a common pitfall leading to more or less subtle issues. (#3164, #3309, #6800)
|
it does, this has been a common pitfall leading to more or less subtle issues. (#3164, #3309, #6800)
|
||||||
|
@ -7669,7 +7669,7 @@ void ImGui::FocusItem()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSelect;
|
ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSetNavHighlight | ImGuiNavMoveFlags_NoSelect;
|
||||||
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||||
SetNavWindow(window);
|
SetNavWindow(window);
|
||||||
NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags);
|
NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags);
|
||||||
@ -7704,7 +7704,7 @@ void ImGui::SetKeyboardFocusHere(int offset)
|
|||||||
|
|
||||||
SetNavWindow(window);
|
SetNavWindow(window);
|
||||||
|
|
||||||
ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_Activate | ImGuiNavMoveFlags_FocusApi;
|
ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_IsTabbing | ImGuiNavMoveFlags_Activate | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSetNavHighlight;
|
||||||
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||||
NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, move_flags, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, move_flags, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable.
|
||||||
if (offset == -1)
|
if (offset == -1)
|
||||||
@ -11727,7 +11727,6 @@ void ImGui::NavUpdateCreateTabbingRequest()
|
|||||||
|
|
||||||
// Initiate tabbing request
|
// Initiate tabbing request
|
||||||
// (this is ALWAYS ENABLED, regardless of ImGuiConfigFlags_NavEnableKeyboard flag!)
|
// (this is ALWAYS ENABLED, regardless of ImGuiConfigFlags_NavEnableKeyboard flag!)
|
||||||
// Initially this was designed to use counters and modulo arithmetic, but that could not work with unsubmitted items (list clipper). Instead we use a strategy close to other move requests.
|
|
||||||
// See NavProcessItemForTabbingRequest() for a description of the various forward/backward tabbing cases with and without wrapping.
|
// See NavProcessItemForTabbingRequest() for a description of the various forward/backward tabbing cases with and without wrapping.
|
||||||
const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
if (nav_keyboard_active)
|
if (nav_keyboard_active)
|
||||||
@ -11835,7 +11834,6 @@ void ImGui::NavMoveRequestApplyResult()
|
|||||||
{
|
{
|
||||||
g.NavNextActivateId = result->ID;
|
g.NavNextActivateId = result->ID;
|
||||||
g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||||
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
|
||||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing)
|
if (g.NavMoveFlags & ImGuiNavMoveFlags_IsTabbing)
|
||||||
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
|
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user