diff options
author | ShadowNinja <shadowninja@minetest.net> | 2016-03-12 11:58:02 -0500 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2016-03-12 12:01:40 -0500 |
commit | 8c951cae5bcfa715e227d47d122cc2de45d70a63 (patch) | |
tree | 5d7928b7cd2c649de2c972553961659273a07191 | |
parent | 20312fda18cb93b85e26d39a5b7386d7f7be9148 (diff) | |
download | minetest-8c951cae5bcfa715e227d47d122cc2de45d70a63.tar.gz minetest-8c951cae5bcfa715e227d47d122cc2de45d70a63.tar.bz2 minetest-8c951cae5bcfa715e227d47d122cc2de45d70a63.zip |
Fix chat console not opening after formspec opened over it
The MainMenuManager set the console invisible when a
formspec opened over it, but didn't properly close it,
and the chat console never set itself visible again.
-rw-r--r-- | src/guiChatConsole.cpp | 17 | ||||
-rw-r--r-- | src/guiChatConsole.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp index d59937c31..ec9d3ffdc 100644 --- a/src/guiChatConsole.cpp +++ b/src/guiChatConsole.cpp @@ -122,6 +122,8 @@ void GUIChatConsole::openConsole(f32 height) m_desired_height_fraction = height; m_desired_height = height * m_screensize.Y; reformatConsole(); + m_animate_time_old = getTimeMs(); + IGUIElement::setVisible(true); Environment->setFocus(this); m_menumgr->createdMenu(this); } @@ -243,6 +245,11 @@ void GUIChatConsole::animate(u32 msec) { // animate the console height s32 goal = m_open ? m_desired_height : 0; + + // Set invisible if close animation finished (reset by openConsole) + if (!m_open && m_height == 0) + IGUIElement::setVisible(false); + if (m_height != goal) { s32 max_change = msec * m_screensize.Y * (m_height_speed / 1000.0); @@ -628,3 +635,13 @@ bool GUIChatConsole::OnEvent(const SEvent& event) return Parent ? Parent->OnEvent(event) : false; } +void GUIChatConsole::setVisible(bool visible) +{ + m_open = visible; + IGUIElement::setVisible(visible); + if (!visible) { + m_height = 0; + recalculateConsolePosition(); + } +} + diff --git a/src/guiChatConsole.h b/src/guiChatConsole.h index fe595f284..3013a1d31 100644 --- a/src/guiChatConsole.h +++ b/src/guiChatConsole.h @@ -77,6 +77,8 @@ public: virtual bool OnEvent(const SEvent& event); + virtual void setVisible(bool visible); + private: void reformatConsole(); void recalculateConsolePosition(); |