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

impr: Insert short delay before opening popups so the animation finishes

This commit is contained in:
WerWolv 2023-07-23 18:22:53 +02:00
parent fdd2e1fcde
commit aa66d4b9e7

View File

@ -568,12 +568,19 @@ namespace hex {
static bool popupDisplaying = false; static bool popupDisplaying = false;
static bool positionSet = false; static bool positionSet = false;
static bool sizeSet = false; static bool sizeSet = false;
static double popupDelay = -2.0;
static std::unique_ptr<impl::PopupBase> currPopup; static std::unique_ptr<impl::PopupBase> currPopup;
static LangEntry name(""); static LangEntry name("");
if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) { if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) {
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) { if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) {
if (popupDelay <= -1.0) {
popupDelay = 200;
} else {
popupDelay -= this->m_lastFrameTime;
if (popupDelay < 0) {
popupDelay = -2.0;
currPopup = std::move(popups.back()); currPopup = std::move(popups.back());
name = LangEntry(currPopup->getUnlocalizedName()); name = LangEntry(currPopup->getUnlocalizedName());
@ -581,6 +588,8 @@ namespace hex {
popups.pop_back(); popups.pop_back();
} }
} }
}
}
if (currPopup != nullptr) { if (currPopup != nullptr) {
bool open = true; bool open = true;