Fixed: Update text widget parent size when interface scale changes

--HG--
branch : experimental-ui-scaling
This commit is contained in:
Nimetu 2016-06-07 17:27:00 +03:00
parent 34fa04644e
commit 2cb71e654a
2 changed files with 12 additions and 3 deletions

View file

@ -614,6 +614,7 @@ namespace NLGUI
uint32 _ScreenH;
uint32 _ScreenW;
float _InterfaceScale;
std::vector< CInterfaceAnim* > activeAnims;

View file

@ -1850,9 +1850,10 @@ namespace NLGUI
class InvalidateTextVisitor : public CInterfaceElementVisitor
{
public:
InvalidateTextVisitor( bool reset )
InvalidateTextVisitor( bool reset, bool invalidate )
{
this->reset = reset;
this->invalidate = invalidate;
}
void visitGroup( CInterfaceGroup *group )
@ -1865,6 +1866,9 @@ namespace NLGUI
{
if( reset )
vt->resetTextIndex();
if( invalidate )
vt->invalidateContent();
else
vt->updateTextContext();
}
}
@ -1872,6 +1876,7 @@ namespace NLGUI
private:
bool reset;
bool invalidate;
};
// ------------------------------------------------------------------------------------------------
@ -1884,6 +1889,8 @@ namespace NLGUI
CViewRenderer::getInstance()->checkNewScreenSize ();
CViewRenderer::getInstance()->getScreenSize (w, h);
bool scaleChanged = _InterfaceScale != CViewRenderer::getInstance()->getInterfaceScale();
// Update ui:* (limit the master containers to the height of the screen)
for (nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
@ -1902,7 +1909,7 @@ namespace NLGUI
{
SMasterGroup &rMG = _MasterGroups[nMasterGroup];
InvalidateTextVisitor inv( false );
InvalidateTextVisitor inv( false, scaleChanged );
rMG.Group->visitGroupAndChildren( &inv );
rMG.Group->invalidateCoords ();
@ -3725,6 +3732,7 @@ namespace NLGUI
inGame = false;
setScreenWH(0, 0);
_InterfaceScale = 1.0f;
_GroupSelection = false;
multiSelection = false;