mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Fixed SetWindowPos/SetNextWindowPos affectiving size computation (#175)
This commit is contained in:
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;
|
bool window_pos_set_by_api = false;
|
||||||
if (g.SetNextWindowPosCond)
|
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);
|
ImGui::SetWindowPos(g.SetNextWindowPosVal, g.SetNextWindowPosCond);
|
||||||
window->DC.CursorPos = backup_cursor_pos;
|
window->DC.CursorPos = backup_cursor_pos;
|
||||||
window_pos_set_by_api = true;
|
window_pos_set_by_api = true;
|
||||||
@ -3707,6 +3707,7 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co
|
|||||||
window->PosFloat = pos;
|
window->PosFloat = pos;
|
||||||
window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y);
|
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.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)
|
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
||||||
|
Loading…
Reference in New Issue
Block a user