mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-15 11:33:29 +01:00
Docking: VisibleWindow of a node spread its _NoMove attribute to the node (fixed dragging or undocking of dock node host from collapse button). (#2325, #2109)
This commit is contained in:
parent
5536edede9
commit
dc8ff68871
13
imgui.cpp
13
imgui.cpp
@ -3172,7 +3172,14 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window)
|
||||
SetActiveID(window->MoveId, window);
|
||||
g.NavDisableHighlight = true;
|
||||
g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos;
|
||||
if (!(window->Flags & ImGuiWindowFlags_NoMove) && !(window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||
|
||||
bool can_move_window = true;
|
||||
if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||
can_move_window = false;
|
||||
if (ImGuiDockNode* node = window->DockNodeAsHost)
|
||||
if (node->VisibleWindow && (node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||
can_move_window = false;
|
||||
if (can_move_window)
|
||||
g.MovingWindow = window;
|
||||
}
|
||||
|
||||
@ -11064,7 +11071,7 @@ static void ImGui::DockNodeStartMouseMovingWindow(ImGuiDockNode* node, ImGuiWind
|
||||
IM_ASSERT(node->WantMouseMove == true);
|
||||
ImVec2 backup_active_click_offset = g.ActiveIdClickOffset;
|
||||
StartMouseMovingWindow(window);
|
||||
g.MovingWindow = window; // If we are docked into a non moveable root widnow, StartMouseMovingWindow() won't set g.MovingWindow. OVerride that decision.
|
||||
g.MovingWindow = window; // If we are docked into a non moveable root window, StartMouseMovingWindow() won't set g.MovingWindow. Override that decision.
|
||||
node->WantMouseMove = false;
|
||||
g.ActiveIdClickOffset = backup_active_click_offset;
|
||||
}
|
||||
@ -11533,6 +11540,8 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
|
||||
if (IsMouseClicked(0))
|
||||
{
|
||||
focus_tab_id = tab_bar->SelectedTabId;
|
||||
|
||||
// Forward moving request to selected window
|
||||
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, focus_tab_id))
|
||||
StartMouseMovingWindow(tab->Window);
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos, ImGuiDockNode* dock_no
|
||||
if (IsItemActive() && IsMouseDragging(0))
|
||||
{
|
||||
bool can_extract_dock_node = false;
|
||||
if (dock_node != NULL)
|
||||
if (dock_node != NULL && dock_node->VisibleWindow && !(dock_node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove))
|
||||
{
|
||||
ImGuiDockNode* root_node = DockNodeGetRootNode(dock_node);
|
||||
if (root_node->OnlyNodeWithWindows != dock_node || (root_node->CentralNode != NULL))
|
||||
|
Loading…
Reference in New Issue
Block a user