mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	Fixed SetWindowPos/SetNextWindowPos affectiving size computation (#175)
This commit is contained in:
		| @@ -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; | ||||
| @@ -3706,7 +3706,8 @@ static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond co | ||||
|     const ImVec2 old_pos = window->Pos; | ||||
|     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.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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user