mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-07 21:39:54 +02:00
Docking: Renamed io.ConfigDockingWithKeyMode to io.ConfigDockingWithShift.
This commit is contained in:
10
imgui.cpp
10
imgui.cpp
@ -1090,7 +1090,7 @@ ImGuiIO::ImGuiIO()
|
||||
DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||||
|
||||
// Miscellaneous configuration options
|
||||
ConfigDockingWithKeyMod = true;
|
||||
ConfigDockingWithShift = false;
|
||||
#ifdef __APPLE__
|
||||
ConfigMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag
|
||||
#else
|
||||
@ -5519,7 +5519,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 BeginAsDockableDragDropSource() also overwrites it.
|
||||
if ((g.ActiveId == window->MoveId) && ((g.IO.ConfigDockingWithKeyMod && g.IO.KeyShift) || (!g.IO.ConfigDockingWithKeyMod)))
|
||||
if ((g.ActiveId == window->MoveId) && ((g.IO.ConfigDockingWithShift && g.IO.KeyShift) || (!g.IO.ConfigDockingWithShift)))
|
||||
if ((window->RootWindow->Flags & (ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDocking)) == 0)
|
||||
BeginAsDockableDragDropSource(window);
|
||||
|
||||
@ -11062,7 +11062,7 @@ static bool ImGui::DockNodePreviewDockCalc(ImGuiWindow* host_window, ImGuiDockNo
|
||||
|
||||
// When docking without holding Shift, 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.ConfigDockingWithKeyMod)
|
||||
if (!is_explicit_target && !data->IsSplitDirExplicit && !g.IO.ConfigDockingWithShift)
|
||||
data->IsDropAllowed = false;
|
||||
|
||||
// Calculate split area
|
||||
@ -12005,7 +12005,7 @@ void ImGui::BeginAsDockableDragDropSource(ImGuiWindow* window)
|
||||
window->DC.LastItemId = window->MoveId;
|
||||
window = window->RootWindow;
|
||||
IM_ASSERT((window->Flags & ImGuiWindowFlags_NoDocking) == 0);
|
||||
bool is_drag_docking = (g.IO.ConfigDockingWithKeyMod) || ImRect(0, 0, window->SizeFull.x, GetFrameHeight()).Contains(g.ActiveIdClickOffset);
|
||||
bool is_drag_docking = (g.IO.ConfigDockingWithShift) || ImRect(0, 0, window->SizeFull.x, GetFrameHeight()).Contains(g.ActiveIdClickOffset);
|
||||
if (is_drag_docking && BeginDragDropSource(ImGuiDragDropFlags_SourceNoPreviewTooltip | ImGuiDragDropFlags_SourceNoHoldToOpenOthers | ImGuiDragDropFlags_SourceAutoExpirePayload))
|
||||
{
|
||||
SetDragDropPayload(IMGUI_PAYLOAD_TYPE_WINDOW, &window, sizeof(window));
|
||||
@ -12047,7 +12047,7 @@ void ImGui::BeginAsDockableDragDropTarget(ImGuiWindow* window)
|
||||
allow_null_target_node = true; // Dock into a regular window
|
||||
|
||||
const ImRect explicit_target_rect = (target_node && target_node->TabBar) ? target_node->TabBar->BarRect : ImRect(window->Pos, window->Pos + ImVec2(window->Size.x, GetFrameHeight()));
|
||||
const bool is_explicit_target = g.IO.ConfigDockingWithKeyMod || IsMouseHoveringRect(explicit_target_rect.Min, explicit_target_rect.Max);
|
||||
const bool is_explicit_target = g.IO.ConfigDockingWithShift || 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