mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-05 20:48:46 +02:00
Docking: removed io.ConfigDockingWithShift option. (#2109)
This commit is contained in:
11
imgui.cpp
11
imgui.cpp
@ -1101,7 +1101,6 @@ ImGuiIO::ImGuiIO()
|
||||
|
||||
// Docking options (when ImGuiConfigFlags_DockingEnable is set)
|
||||
ConfigDockingNoSplit = false;
|
||||
ConfigDockingWithShift = false;
|
||||
ConfigDockingAlwaysTabBar = false;
|
||||
ConfigDockingTransparentPayload = false;
|
||||
|
||||
@ -6784,7 +6783,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
{
|
||||
// Docking: Dragging a dockable window (or any of its child) turns it into a drag and drop source.
|
||||
// We need to do this _before_ we overwrite window->DC.LastItemId below because BeginDockableDragDropSource() also overwrites it.
|
||||
if ((g.MovingWindow == window) && (g.IO.ConfigDockingWithShift == g.IO.KeyShift))
|
||||
if (g.MovingWindow == window && g.IO.KeyShift == false)
|
||||
if ((window->RootWindowDockTree->Flags & ImGuiWindowFlags_NoDocking) == 0)
|
||||
BeginDockableDragDropSource(window);
|
||||
|
||||
@ -14200,9 +14199,9 @@ static void ImGui::DockNodePreviewDockSetup(ImGuiWindow* host_window, ImGuiDockN
|
||||
}
|
||||
}
|
||||
|
||||
// When docking without holding Shift, we only allow and preview docking when hovering over a drop rect or over the title bar
|
||||
// We only allow and preview docking when hovering over a drop rect or over the title bar
|
||||
data->IsDropAllowed = (data->SplitDir != ImGuiDir_None) || (data->IsCenterAvailable);
|
||||
if (!is_explicit_target && !data->IsSplitDirExplicit && !g.IO.ConfigDockingWithShift)
|
||||
if (!is_explicit_target && !data->IsSplitDirExplicit)
|
||||
data->IsDropAllowed = false;
|
||||
|
||||
// Calculate split area
|
||||
@ -15472,7 +15471,7 @@ void ImGui::BeginDockableDragDropSource(ImGuiWindow* window)
|
||||
window->DC.LastItemId = window->MoveId;
|
||||
window = window->RootWindowDockTree;
|
||||
IM_ASSERT((window->Flags & ImGuiWindowFlags_NoDocking) == 0);
|
||||
bool is_drag_docking = (g.IO.ConfigDockingWithShift) || ImRect(0, 0, window->SizeFull.x, GetFrameHeight()).Contains(g.ActiveIdClickOffset);
|
||||
bool is_drag_docking = ImRect(0, 0, window->SizeFull.x, GetFrameHeight()).Contains(g.ActiveIdClickOffset); // FIXME-DOCKING: Need to make this stateful and explicit
|
||||
if (is_drag_docking && BeginDragDropSource(ImGuiDragDropFlags_SourceNoPreviewTooltip | ImGuiDragDropFlags_SourceNoHoldToOpenOthers | ImGuiDragDropFlags_SourceAutoExpirePayload))
|
||||
{
|
||||
SetDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, &window, sizeof(window));
|
||||
@ -15533,7 +15532,7 @@ void ImGui::BeginDockableDragDropTarget(ImGuiWindow* window)
|
||||
}
|
||||
|
||||
const ImRect explicit_target_rect = (node && node->TabBar && !node->IsHiddenTabBar() && !node->IsNoTabBar()) ? node->TabBar->BarRect : ImRect(window->Pos, window->Pos + ImVec2(window->Size.x, GetFrameHeight()));
|
||||
const bool is_explicit_target = g.IO.ConfigDockingWithShift || IsMouseHoveringRect(explicit_target_rect.Min, explicit_target_rect.Max);
|
||||
const bool is_explicit_target = IsMouseHoveringRect(explicit_target_rect.Min, explicit_target_rect.Max);
|
||||
|
||||
// Preview docking request and find out split direction/ratio
|
||||
//const bool do_preview = true; // Ignore testing for payload->IsPreview() which removes one frame of delay, but breaks overlapping drop targets within the same window.
|
||||
|
Reference in New Issue
Block a user