mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-07 13:35:49 +02:00
Nav, Focus: Changed SetKeyboardFocusHere() to not behave if a drag or window moving is in progress + move KeepAliveID() call from Scrollbar() to ScrollbarEx()
This commit is contained in:
11
imgui.cpp
11
imgui.cpp
@ -7386,6 +7386,17 @@ void ImGui::SetKeyboardFocusHere(int offset)
|
||||
IM_ASSERT(offset >= -1); // -1 is allowed but not below
|
||||
IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere(%d) in window \"%s\"\n", offset, window->Name);
|
||||
|
||||
// It makes sense in the vast majority of cases to never interrupt a drag and drop.
|
||||
// When we refactor this function into ActivateItem() we may want to make this an option.
|
||||
// Note that g.ActiveId being stolen while g.MovingWindow != NULL is currently ill-defined (subtle side-effects on master, assert in docking),
|
||||
// so there's another layer we need to fix. Would make sense to automatically drop g.MovingWindow when g.ActiveId is changed.
|
||||
// MovingWindow is protected from most user inputs using SetActiveIdUsingNavAndKeys() but we may need to enforce a better more encompassing scheme.
|
||||
if (g.DragDropActive || g.MovingWindow != NULL)
|
||||
{
|
||||
IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere() ignored while DragDropActive!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SetNavWindow(window);
|
||||
|
||||
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||
|
Reference in New Issue
Block a user