fix: Popups not being centered correctly
This commit is contained in:
parent
f9a08f5c11
commit
09f1b56964
@ -538,18 +538,23 @@ namespace hex {
|
||||
bool open = true;
|
||||
ImGui::SetNextWindowSizeConstraints(currPopup->getMinSize(), currPopup->getMaxSize());
|
||||
|
||||
auto closeButton = currPopup->hasCloseButton() ? &open : nullptr;
|
||||
auto flags = currPopup->getFlags();
|
||||
const auto closeButton = currPopup->hasCloseButton() ? &open : nullptr;
|
||||
const auto flags = currPopup->getFlags();
|
||||
|
||||
const auto windowSize = ImHexApi::System::getMainWindowSize();
|
||||
|
||||
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5F, 0.5F));
|
||||
if (currPopup->isModal()) {
|
||||
if (ImGui::BeginPopupModal(name, closeButton, flags)) {
|
||||
ImGui::SetWindowPos((windowSize - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing);
|
||||
|
||||
currPopup->drawContent();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
} else {
|
||||
if (ImGui::BeginPopup(name, flags)) {
|
||||
ImGui::SetWindowPos((windowSize - ImGui::GetWindowSize()) / 2, ImGuiCond_Appearing);
|
||||
|
||||
currPopup->drawContent();
|
||||
|
||||
ImGui::EndPopup();
|
||||
|
Loading…
x
Reference in New Issue
Block a user