From 1c65914b1097b0c449ba97284aa68ce407b95f5a Mon Sep 17 00:00:00 2001 From: bensaine Date: Sat, 26 Feb 2022 02:50:56 -0500 Subject: [PATCH] fix: tooltip opacity --- nel/include/nel/gui/interface_group.h | 1 - nel/src/gui/interface_group.cpp | 12 --------- nel/src/gui/widget_manager.cpp | 37 ++++++++++++++++----------- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/nel/include/nel/gui/interface_group.h b/nel/include/nel/gui/interface_group.h index 3948ebcaf..672e52e6a 100644 --- a/nel/include/nel/gui/interface_group.h +++ b/nel/include/nel/gui/interface_group.h @@ -271,7 +271,6 @@ namespace NLGUI virtual sint32 getAlpha() const; virtual void setAlpha (sint32 a); - virtual void setContainerAlpha (sint32 a); /// Eval current clip coords. This is not incremental as with makeNewClip, and thus more slow. This also doesn't change the current clip window. void getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const; diff --git a/nel/src/gui/interface_group.cpp b/nel/src/gui/interface_group.cpp index 77f4fa056..87504cf24 100644 --- a/nel/src/gui/interface_group.cpp +++ b/nel/src/gui/interface_group.cpp @@ -2153,18 +2153,6 @@ namespace NLGUI } } - // ------------------------------------------------------------------------------------------------ - void CInterfaceGroup::setContainerAlpha (sint32 a) - { - vector::const_iterator itv; - for (itv = _Views.begin(); itv != _Views.end(); itv++) - { - CViewBase *pVB = *itv; - nlwarning("setContainerAlpha: %s %s", pVB->getShortID().c_str(), std::to_string(pVB->getRenderLayer()).c_str()); - pVB->setAlpha(a); - } - } - // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::setLeftClickHandler(const std::string &handler) { diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 60ffc22e6..d1f8c2a09 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1779,34 +1779,41 @@ namespace NLGUI getWindowForActiveMasterGroup(_CurCtrlContextHelp->getContextHelpWindowName()); if(groupContextHelp) - { - groupContextHelp->setContainerAlpha(100); + { /** If there's a modal box around, should be sure that the context help doesn't intersect it. * If this is the case, we just disable it, unless the tooltip was generated by the current modal window */ + + bool draw = false; if ( hasModal() ) { CInterfaceGroup *mw = getModal().ModalWindow; if (mw && mw->isIn(*groupContextHelp)) { if (_CurCtrlContextHelp->isSonOf(mw)) - { - groupContextHelp->executeLuaScriptOnDraw(); - groupContextHelp->draw (); - // flush layers - CViewRenderer::getInstance()->flush(); - } + draw = true; } else - { - groupContextHelp->executeLuaScriptOnDraw(); - groupContextHelp->draw (); - // flush layers - CViewRenderer::getInstance()->flush(); - } + draw = true; } else - { + draw = true; + + if (draw) { + // apply opacity settings + const std::vector< CViewBase* > &vs = groupContextHelp->getViews(); + // content opacity: only target views or else breaks + for( std::vector< CViewBase* >::const_iterator itr = vs.begin(); itr != vs.end(); ++itr ) + { + CViewBase *pVB = *itr; + pVB->setAlpha(_ContextHelpContentAlpha); + } + // container opacity + CInterfaceGroup* container = dynamic_cast(groupContextHelp->findFromShortId("border")) + if (container) + container->setAlpha(_ContextHelpContainerAlpha); + + // draw the tooltip groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->draw (); // flush layers