1
0
mirror of synced 2024-11-28 01:20:51 +01:00

fix: Closing popups using Esc causing them to re-appear

This commit is contained in:
WerWolv 2023-05-10 22:29:17 +02:00
parent 0b29719fe9
commit 1d2b8ac1f3

View File

@ -530,17 +530,24 @@ namespace hex {
// Draw popup stack
{
static bool popupDisplaying = false;
static bool positionSet = false;
static bool sizeSet = false;
static std::unique_ptr<impl::PopupBase> currPopup;
static LangEntry name("");
if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) {
static bool popupDisplaying = false;
static bool positionSet = false;
static bool sizeSet = false;
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) {
currPopup = std::move(popups.back());
name = LangEntry(currPopup->getUnlocalizedName());
auto &currPopup = popups.back();
const auto &name = LangEntry(currPopup->getUnlocalizedName());
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId))
ImGui::OpenPopup(name);
popups.pop_back();
}
}
if (currPopup != nullptr) {
bool open = true;
const auto &minSize = currPopup->getMinSize();
@ -585,8 +592,7 @@ namespace hex {
log::debug("Closing popup '{}'", name);
positionSet = sizeSet = false;
if (auto it = std::find(popups.begin(), popups.end(), currPopup); it != popups.end())
popups.erase(it);
currPopup = nullptr;
}
}
}