mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
Nav: Page/Home/End doesn't immediately restore highlight (before results comes) + pressing Esc to exit a child window re-enable the Nav highlight if it was disabled by mouse.
Also fix a move request fail restoring highlight from not moving mouse cursor. Add NavRestoreHighlightAfterMove() helper a little bit of extra sanity.
This commit is contained in:
parent
978598b174
commit
14466a6d19
@ -41,10 +41,13 @@ Other Changes:
|
||||
- Added IsMouseTripleClicked() function. Tracking multi-click count in IO structure. (#3229) [@kudaba]
|
||||
- Modals: fixed issue hovering popups inside a child inside a modal. (#4676, #4527)
|
||||
- Fixed IsWindowFocused()/IsWindowHovered() issues with childs inside popups. (#4676)
|
||||
- Nav: fixed absolute mouse position (with NavEnableSetMousePos config flag) when using Home/End
|
||||
leads to scrolling.
|
||||
- Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer.
|
||||
- Nav: fixed resizing window from borders setting navigation to Menu layer.
|
||||
- Nav: pressing Esc to exit a child window reactivates the Nav highlight if it was disabled by mouse.
|
||||
- Nav: (with ImGuiConfigFlags_NavEnableSetMousePos): fixed absolute mouse position when using Home/End
|
||||
leads to scrolling.
|
||||
- Nav: (with ImGuiConfigFlags_NavEnableSetMousePos): fixed not setting mouse position when a failed
|
||||
move request (e.g. already at edge) reactivate the navigation highlight.
|
||||
- InputText: made double-click select word, triple-line select line. Word delimitation logic differs
|
||||
slightly from the one used by CTRL+arrows. (#2244)
|
||||
- Backends: Vulkan: Call vkCmdSetScissor() at the end of render with a full-viewport to reduce
|
||||
|
29
imgui.cpp
29
imgui.cpp
@ -926,6 +926,7 @@ static ImVec2 NavCalcPreferredRefPos();
|
||||
static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window);
|
||||
static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window);
|
||||
static void NavRestoreLayer(ImGuiNavLayer layer);
|
||||
static void NavRestoreHighlightAfterMove();
|
||||
static int FindWindowFocusIndex(ImGuiWindow* window);
|
||||
|
||||
// Error Checking and Debug Tools
|
||||
@ -8811,8 +8812,6 @@ void ImGui::SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id
|
||||
g.NavFocusScopeId = focus_scope_id;
|
||||
g.NavWindow->NavLastIds[nav_layer] = id;
|
||||
g.NavWindow->NavRectRel[nav_layer] = rect_rel;
|
||||
//g.NavDisableHighlight = false;
|
||||
//g.NavDisableMouseHover = g.NavMousePosDirty = true;
|
||||
}
|
||||
|
||||
void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
|
||||
@ -9187,6 +9186,11 @@ void ImGui::NavRestoreLayer(ImGuiNavLayer layer)
|
||||
g.NavLayer = layer;
|
||||
NavInitWindow(window, true);
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::NavRestoreHighlightAfterMove()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NavDisableHighlight = false;
|
||||
g.NavDisableMouseHover = g.NavMousePosDirty = true;
|
||||
}
|
||||
@ -9486,10 +9490,7 @@ void ImGui::NavInitRequestApplyResult()
|
||||
SetNavID(g.NavInitResultId, g.NavLayer, 0, g.NavInitResultRectRel);
|
||||
g.NavIdIsAlive = true; // Mark as alive from previous frame as we got a result
|
||||
if (g.NavInitRequestFromMove)
|
||||
{
|
||||
g.NavDisableHighlight = false;
|
||||
g.NavDisableMouseHover = g.NavMousePosDirty = true;
|
||||
}
|
||||
NavRestoreHighlightAfterMove();
|
||||
}
|
||||
|
||||
void ImGui::NavUpdateCreateMoveRequest()
|
||||
@ -9604,10 +9605,7 @@ void ImGui::NavMoveRequestApplyResult()
|
||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
||||
g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight;
|
||||
if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0)
|
||||
{
|
||||
g.NavDisableHighlight = false;
|
||||
g.NavDisableMouseHover = true;
|
||||
}
|
||||
NavRestoreHighlightAfterMove();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -9669,10 +9667,7 @@ void ImGui::NavMoveRequestApplyResult()
|
||||
|
||||
// Enable nav highlight
|
||||
if ((g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0)
|
||||
{
|
||||
g.NavDisableHighlight = false;
|
||||
g.NavDisableMouseHover = g.NavMousePosDirty = true;
|
||||
}
|
||||
NavRestoreHighlightAfterMove();
|
||||
}
|
||||
|
||||
// Process NavCancel input (to close a popup, get back to parent, clear focus)
|
||||
@ -9695,6 +9690,7 @@ static void ImGui::NavUpdateCancelRequest()
|
||||
{
|
||||
// Leave the "menu" layer
|
||||
NavRestoreLayer(ImGuiNavLayer_Main);
|
||||
NavRestoreHighlightAfterMove();
|
||||
}
|
||||
else if (g.NavWindow && g.NavWindow != g.NavWindow->RootWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow)
|
||||
{
|
||||
@ -9705,6 +9701,7 @@ static void ImGui::NavUpdateCancelRequest()
|
||||
ImRect child_rect = child_window->Rect();
|
||||
FocusWindow(parent_window);
|
||||
SetNavID(child_window->ChildId, ImGuiNavLayer_Main, 0, WindowRectAbsToRel(parent_window, child_rect));
|
||||
NavRestoreHighlightAfterMove();
|
||||
}
|
||||
else if (g.OpenPopupStack.Size > 0)
|
||||
{
|
||||
@ -10031,8 +10028,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindow))
|
||||
{
|
||||
ClearActiveID();
|
||||
g.NavDisableHighlight = false;
|
||||
g.NavDisableMouseHover = true;
|
||||
NavRestoreHighlightAfterMove();
|
||||
apply_focus_window = NavRestoreLastChildNavWindow(apply_focus_window);
|
||||
ClosePopupsOverWindow(apply_focus_window, false);
|
||||
FocusWindow(apply_focus_window);
|
||||
@ -10079,6 +10075,7 @@ static void ImGui::NavUpdateWindowing()
|
||||
if (new_nav_layer == ImGuiNavLayer_Menu)
|
||||
g.NavWindow->NavLastIds[new_nav_layer] = 0;
|
||||
NavRestoreLayer(new_nav_layer);
|
||||
NavRestoreHighlightAfterMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user