From 2cb71e654ae945a67cb9a306847e2b28de84220a Mon Sep 17 00:00:00 2001 From: Nimetu Date: Tue, 7 Jun 2016 17:27:00 +0300 Subject: [PATCH] Fixed: Update text widget parent size when interface scale changes --HG-- branch : experimental-ui-scaling --- code/nel/include/nel/gui/widget_manager.h | 1 + code/nel/src/gui/widget_manager.cpp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index cfb51af8e..7566a8ad4 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -614,6 +614,7 @@ namespace NLGUI uint32 _ScreenH; uint32 _ScreenW; + float _InterfaceScale; std::vector< CInterfaceAnim* > activeAnims; diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index f866594c9..0288bff12 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -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,13 +1866,17 @@ namespace NLGUI { if( reset ) vt->resetTextIndex(); - vt->updateTextContext(); + if( invalidate ) + vt->invalidateContent(); + else + vt->updateTextContext(); } } } 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;