1
0
forked from 0ad/0ad

Allow the JS GUI to subscribe to the window resized event and use it to conditionally update the observer panel (refs D689).

Differential Revision: https://code.wildfiregames.com/D694
Tested By: temple
Proofread By: Vladislav
This was SVN commit r19846.
This commit is contained in:
elexis 2017-06-30 00:04:29 +00:00
parent 5e6b502eab
commit 6f7a5fb773
3 changed files with 20 additions and 1 deletions

View File

@ -772,6 +772,12 @@ function onTick()
Engine.GuiInterfaceCall("ClearRenamedEntities");
}
function onWindowResized()
{
// Update followPlayerLabel
updateTopPanel();
}
function changeGameSpeed(speed)
{
if (!g_IsNetworked)

View File

@ -17,10 +17,15 @@
<script directory="gui/session/"/>
<object name="sn">
<action on="Tick">
onTick();
</action>
<action on="WindowResized">
onWindowResized();
</action>
<action on="SimulationUpdate">
onSimulationUpdate();
</action>

View File

@ -419,8 +419,16 @@ void CGUIManager::Draw()
void CGUIManager::UpdateResolution()
{
for (const SGUIPage& p : m_PageStack)
// Save an immutable copy so iterators aren't invalidated by event handlers
PageStackType pageStack = m_PageStack;
for (const SGUIPage& p : pageStack)
{
m_CurrentGUI = p.gui;
p.gui->UpdateResolution();
p.gui->SendEventToAll("WindowResized");
}
m_CurrentGUI.reset();
}
bool CGUIManager::TemplateExists(const std::string& templateName) const