Fixed SetWindowPos/SetNextWindowPos affectiving size computation (#175)

docking
ocornut 10 years ago
parent 5737a79c8d
commit b578e86971

@ -2915,7 +2915,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
bool window_pos_set_by_api = false;
if (g.SetNextWindowPosCond)
{
const ImVec2 backup_cursor_pos = window->DC.CursorPos;
const ImVec2 backup_cursor_pos = window->DC.CursorPos; // FIXME: not sure of the exact reason of this anymore :( need to look into that.
ImGui::SetWindowPos(g.SetNextWindowPosVal, g.SetNextWindowPosCond);
window->DC.CursorPos = backup_cursor_pos;
window_pos_set_by_api = true;
@ -3707,6 +3707,7 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co
window->PosFloat = pos;
window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y);
window->DC.CursorPos += (window->Pos - old_pos); // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
window->DC.CursorMaxPos += (window->Pos - old_pos); // And more importantly we need to adjust this so size calculation doesn't get affected.
}
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond)

Loading…
Cancel
Save