fix: Closing popups using Esc causing them to re-appear
This commit is contained in:
parent
0b29719fe9
commit
1d2b8ac1f3
@ -530,17 +530,24 @@ namespace hex {
|
|||||||
|
|
||||||
// Draw popup stack
|
// 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()) {
|
if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) {
|
||||||
static bool popupDisplaying = false;
|
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) {
|
||||||
static bool positionSet = false;
|
currPopup = std::move(popups.back());
|
||||||
static bool sizeSet = false;
|
name = LangEntry(currPopup->getUnlocalizedName());
|
||||||
|
|
||||||
auto &currPopup = popups.back();
|
|
||||||
const auto &name = LangEntry(currPopup->getUnlocalizedName());
|
|
||||||
|
|
||||||
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId))
|
|
||||||
ImGui::OpenPopup(name);
|
ImGui::OpenPopup(name);
|
||||||
|
popups.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currPopup != nullptr) {
|
||||||
bool open = true;
|
bool open = true;
|
||||||
|
|
||||||
const auto &minSize = currPopup->getMinSize();
|
const auto &minSize = currPopup->getMinSize();
|
||||||
@ -585,8 +592,7 @@ namespace hex {
|
|||||||
log::debug("Closing popup '{}'", name);
|
log::debug("Closing popup '{}'", name);
|
||||||
positionSet = sizeSet = false;
|
positionSet = sizeSet = false;
|
||||||
|
|
||||||
if (auto it = std::find(popups.begin(), popups.end(), currPopup); it != popups.end())
|
currPopup = nullptr;
|
||||||
popups.erase(it);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user