Skip to content

Commit 8c951ca

Browse files
committed
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.
1 parent 20312fd commit 8c951ca

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/guiChatConsole.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ void GUIChatConsole::openConsole(f32 height)
122122
m_desired_height_fraction = height;
123123
m_desired_height = height * m_screensize.Y;
124124
reformatConsole();
125+
m_animate_time_old = getTimeMs();
126+
IGUIElement::setVisible(true);
125127
Environment->setFocus(this);
126128
m_menumgr->createdMenu(this);
127129
}
@@ -243,6 +245,11 @@ void GUIChatConsole::animate(u32 msec)
243245
{
244246
// animate the console height
245247
s32 goal = m_open ? m_desired_height : 0;
248+
249+
// Set invisible if close animation finished (reset by openConsole)
250+
if (!m_open && m_height == 0)
251+
IGUIElement::setVisible(false);
252+
246253
if (m_height != goal)
247254
{
248255
s32 max_change = msec * m_screensize.Y * (m_height_speed / 1000.0);
@@ -628,3 +635,13 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
628635
return Parent ? Parent->OnEvent(event) : false;
629636
}
630637

638+
void GUIChatConsole::setVisible(bool visible)
639+
{
640+
m_open = visible;
641+
IGUIElement::setVisible(visible);
642+
if (!visible) {
643+
m_height = 0;
644+
recalculateConsolePosition();
645+
}
646+
}
647+

src/guiChatConsole.h

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class GUIChatConsole : public gui::IGUIElement
7777

7878
virtual bool OnEvent(const SEvent& event);
7979

80+
virtual void setVisible(bool visible);
81+
8082
private:
8183
void reformatConsole();
8284
void recalculateConsolePosition();

0 commit comments

Comments
 (0)