| 7444 | } |
| 7445 | |
| 7446 | void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond) |
| 7447 | { |
| 7448 | // Test condition (NB: bit 0 is always true) and clear flags for next time |
| 7449 | if (cond && (window->SetWindowPosAllowFlags & cond) == 0) |
| 7450 | return; |
| 7451 | |
| 7452 | IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. |
| 7453 | window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); |
| 7454 | window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX); |
| 7455 | |
| 7456 | // Set |
| 7457 | const ImVec2 old_pos = window->Pos; |
| 7458 | window->Pos = ImFloor(pos); |
| 7459 | ImVec2 offset = window->Pos - old_pos; |
| 7460 | if (offset.x == 0.0f && offset.y == 0.0f) |
| 7461 | return; |
| 7462 | MarkIniSettingsDirty(window); |
| 7463 | 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 |
| 7464 | window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected. |
| 7465 | window->DC.IdealMaxPos += offset; |
| 7466 | window->DC.CursorStartPos += offset; |
| 7467 | } |
| 7468 | |
| 7469 | void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond) |
| 7470 | { |
nothing calls this directly
no test coverage detected