mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-19 01:24:20 +00:00
Docking: comments, clairfy why we store style override on dragged windows. Clarify why we don't need to store alpha. (#7535, #2771)
Amend ebbb98d51
This commit is contained in:
parent
5717f0a33e
commit
9d6818d0ce
2 changed files with 11 additions and 6 deletions
15
imgui.cpp
15
imgui.cpp
|
|
@ -19031,6 +19031,13 @@ static ImGuiDockNode* ImGui::DockContextBindNodeToWindow(ImGuiContext* ctx, ImGu
|
|||
return node;
|
||||
}
|
||||
|
||||
static void StoreDockStyleForWindow(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
for (int color_n = 0; color_n < ImGuiWindowDockStyleCol_COUNT; color_n++)
|
||||
window->DockStyle.Colors[color_n] = ImGui::ColorConvertFloat4ToU32(g.Style.Colors[GWindowDockStyleColors[color_n]]);
|
||||
}
|
||||
|
||||
void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
|
@ -19094,8 +19101,7 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
|
|||
}
|
||||
|
||||
// Store style overrides
|
||||
for (int color_n = 0; color_n < ImGuiWindowDockStyleCol_COUNT; color_n++)
|
||||
window->DockStyle.Colors[color_n] = ColorConvertFloat4ToU32(g.Style.Colors[GWindowDockStyleColors[color_n]]);
|
||||
StoreDockStyleForWindow(window);
|
||||
|
||||
// Fast path return. It is common for windows to hold on a persistent DockId but be the only visible window,
|
||||
// and never create neither a host window neither a tab bar.
|
||||
|
|
@ -19185,10 +19191,7 @@ void ImGui::BeginDockableDragDropSource(ImGuiWindow* window)
|
|||
{
|
||||
SetDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, &window, sizeof(window));
|
||||
EndDragDropSource();
|
||||
|
||||
// Store style overrides
|
||||
for (int color_n = 0; color_n < ImGuiWindowDockStyleCol_COUNT; color_n++)
|
||||
window->DockStyle.Colors[color_n] = ColorConvertFloat4ToU32(g.Style.Colors[GWindowDockStyleColors[color_n]]);
|
||||
StoreDockStyleForWindow(window); // Store style overrides while dragging (even when not docked) because docking preview may need it.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue