fix: tooltip opacity

53-setting-to-change-tooltip-opacity
bensaine 3 years ago
parent ddb4cce712
commit 1c65914b10

@ -271,7 +271,6 @@ namespace NLGUI
virtual sint32 getAlpha() const; virtual sint32 getAlpha() const;
virtual void setAlpha (sint32 a); 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. /// 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; void getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const;

@ -2153,18 +2153,6 @@ namespace NLGUI
} }
} }
// ------------------------------------------------------------------------------------------------
void CInterfaceGroup::setContainerAlpha (sint32 a)
{
vector<CViewBase*>::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) void CInterfaceGroup::setLeftClickHandler(const std::string &handler)
{ {

@ -1780,33 +1780,40 @@ namespace NLGUI
if(groupContextHelp) if(groupContextHelp)
{ {
groupContextHelp->setContainerAlpha(100);
/** If there's a modal box around, should be sure that the context help doesn't intersect it. /** 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 * If this is the case, we just disable it, unless the tooltip was generated by the current modal window
*/ */
bool draw = false;
if ( hasModal() ) if ( hasModal() )
{ {
CInterfaceGroup *mw = getModal().ModalWindow; CInterfaceGroup *mw = getModal().ModalWindow;
if (mw && mw->isIn(*groupContextHelp)) if (mw && mw->isIn(*groupContextHelp))
{ {
if (_CurCtrlContextHelp->isSonOf(mw)) if (_CurCtrlContextHelp->isSonOf(mw))
{ draw = true;
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
} }
else else
{ draw = true;
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
} }
else 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<CInterfaceGroup*>(groupContextHelp->findFromShortId("border"))
if (container)
container->setAlpha(_ContextHelpContainerAlpha);
// draw the tooltip
groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw (); groupContextHelp->draw ();
// flush layers // flush layers

Loading…
Cancel
Save