| 8312 | } |
| 8313 | |
| 8314 | void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond) |
| 8315 | { |
| 8316 | // Test condition (NB: bit 0 is always true) and clear flags for next time |
| 8317 | if (cond && (window->SetWindowPosAllowFlags & cond) == 0) |
| 8318 | return; |
| 8319 | |
| 8320 | IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. |
| 8321 | window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); |
| 8322 | window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX); |
| 8323 | |
| 8324 | // Set |
| 8325 | const ImVec2 old_pos = window->Pos; |
| 8326 | window->Pos = ImTrunc(pos); |
| 8327 | ImVec2 offset = window->Pos - old_pos; |
| 8328 | if (offset.x == 0.0f && offset.y == 0.0f) |
| 8329 | return; |
| 8330 | MarkIniSettingsDirty(window); |
| 8331 | window->DC.CursorPos += offset; // 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 |
| 8332 | window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected. |
| 8333 | window->DC.IdealMaxPos += offset; |
| 8334 | window->DC.CursorStartPos += offset; |
| 8335 | } |
| 8336 | |
| 8337 | void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond) |
| 8338 | { |
nothing calls this directly
no test coverage detected