1
0
mirror of synced 2024-11-24 07:40:17 +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,17 +568,26 @@ namespace hex {
static bool popupDisplaying = false;
static bool positionSet = false;
static bool sizeSet = false;
static double popupDelay = -2.0;
static std::unique_ptr<impl::PopupBase> currPopup;
static LangEntry name("");
if (auto &popups = impl::PopupBase::getOpenPopups(); !popups.empty()) {
if (!ImGui::IsPopupOpen(ImGuiID(0), ImGuiPopupFlags_AnyPopupId)) {
currPopup = std::move(popups.back());
name = LangEntry(currPopup->getUnlocalizedName());
if (popupDelay <= -1.0) {
popupDelay = 200;
} else {
popupDelay -= this->m_lastFrameTime;
if (popupDelay < 0) {
popupDelay = -2.0;
currPopup = std::move(popups.back());
name = LangEntry(currPopup->getUnlocalizedName());
ImGui::OpenPopup(name);
popups.pop_back();
ImGui::OpenPopup(name);
popups.pop_back();
}
}
}
}