1
0
mirror of synced 2024-12-01 02:37:18 +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 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)) {
currPopup = std::move(popups.back()); if (popupDelay <= -1.0) {
name = LangEntry(currPopup->getUnlocalizedName()); 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); ImGui::OpenPopup(name);
popups.pop_back(); popups.pop_back();
}
}
} }
} }