tweaked docking so that windows do not float by default
parent
5fc54a04f6
commit
e6d12e22a2
|
@ -856,7 +856,12 @@ namespace ImGui
|
||||||
void rootDock(const ImVec2& pos, const ImVec2& size)
|
void rootDock(const ImVec2& pos, const ImVec2& size)
|
||||||
{
|
{
|
||||||
Dock* root = getRootDock();
|
Dock* root = getRootDock();
|
||||||
if (!root) return;
|
|
||||||
|
// martin: make sure we have a root dock
|
||||||
|
if (!root)
|
||||||
|
root = &getDock("Root", true);
|
||||||
|
|
||||||
|
root->status = Status_Docked;
|
||||||
|
|
||||||
ImVec2 min_size = root->getMinSize();
|
ImVec2 min_size = root->getMinSize();
|
||||||
ImVec2 requested_size = size;
|
ImVec2 requested_size = size;
|
||||||
|
@ -901,7 +906,6 @@ namespace ImGui
|
||||||
void tryDockToStoredLocation(Dock& dock)
|
void tryDockToStoredLocation(Dock& dock)
|
||||||
{
|
{
|
||||||
if (dock.status == Status_Docked) return;
|
if (dock.status == Status_Docked) return;
|
||||||
if (dock.location[0] == 0) return;
|
|
||||||
|
|
||||||
Dock* tmp = getRootDock();
|
Dock* tmp = getRootDock();
|
||||||
if (!tmp) return;
|
if (!tmp) return;
|
||||||
|
@ -921,7 +925,8 @@ namespace ImGui
|
||||||
bool begin(const char* label, bool* opened, ImGuiWindowFlags extra_flags)
|
bool begin(const char* label, bool* opened, ImGuiWindowFlags extra_flags)
|
||||||
{
|
{
|
||||||
Dock& dock = getDock(label, !opened || *opened);
|
Dock& dock = getDock(label, !opened || *opened);
|
||||||
if (!dock.opened && (!opened || *opened)) tryDockToStoredLocation(dock);
|
// martin: tweak docking for better defaults
|
||||||
|
if (!dock.opened || (!opened || *opened)) tryDockToStoredLocation(dock);
|
||||||
dock.last_frame = ImGui::GetFrameCount();
|
dock.last_frame = ImGui::GetFrameCount();
|
||||||
if (strcmp(dock.label, label) != 0)
|
if (strcmp(dock.label, label) != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue