Gui: add SoColorBarLabel as workaround for a Coin3D bug

This commit is contained in:
wmayer
2022-06-07 19:42:04 +02:00
parent b9b21ddac5
commit 77627bbc23
4 changed files with 49 additions and 2 deletions

View File

@@ -298,6 +298,33 @@ void SoTextLabel::GLRender(SoGLRenderAction *action)
// ------------------------------------------------------
SO_NODE_SOURCE(SoColorBarLabel)
void SoColorBarLabel::initClass()
{
SO_NODE_INIT_CLASS(SoColorBarLabel, SoText2, "Text2");
}
SoColorBarLabel::SoColorBarLabel()
{
SO_NODE_CONSTRUCTOR(SoColorBarLabel);
}
void SoColorBarLabel::computeBBox(SoAction * action, SbBox3f & box, SbVec3f & center)
{
inherited::computeBBox(action, box, center);
if (!box.hasVolume()) {
SbViewVolume vv = SoViewVolumeElement::get(action->getState());
// workaround for https://github.com/coin3d/coin/issues/417:
// extend by 2 percent
vv.scaleWidth(1.02f);
SoViewVolumeElement::set(action->getState(), this, vv);
inherited::computeBBox(action, box, center);
}
}
// ------------------------------------------------------
SO_NODE_SOURCE(SoStringLabel)
void SoStringLabel::initClass()