From 15262817930cdda0a2e6107dd7aeb40b39b9c0b1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 3 Jun 2004 09:36:49 +0000 Subject: [PATCH] Added room for tail of text. --- src/osgSim/ScalarBar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/osgSim/ScalarBar.cpp b/src/osgSim/ScalarBar.cpp index 6d5ac0886..9cd7ff6ec 100644 --- a/src/osgSim/ScalarBar.cpp +++ b/src/osgSim/ScalarBar.cpp @@ -191,6 +191,7 @@ void ScalarBar::createDrawables() std::vector texts(_numLabels); // We'll need to collect pointers to these for later float labelIncr = (_stc->getMax()-_stc->getMin())/(_numLabels-1); float labelxIncr = (_width)/(_numLabels-1); + float labely = arOffset + characterSize*0.3f; for(i=0; i<_numLabels; ++i) { osgText::Text* text = new osgText::Text; @@ -200,7 +201,7 @@ void ScalarBar::createDrawables() text->setCharacterSize(characterSize); text->setText(_sp->printScalar(_stc->getMin()+(i*labelIncr))); - text->setPosition(osg::Vec3((i*labelxIncr), arOffset, 0.0f)*matrix); + text->setPosition(osg::Vec3((i*labelxIncr), labely, 0.0f)*matrix); text->setAlignment(osgText::Text::CENTER_BASE_LINE); text->setAxisAlignment( (_orientation==HORIZONTAL) ? osgText::Text::XY_PLANE : osgText::Text::XZ_PLANE ); @@ -222,7 +223,7 @@ void ScalarBar::createDrawables() text->setCharacterSize(characterSize); text->setText(_title); - float titleY = (_numLabels>0) ? arOffset + characterSize : arOffset; + float titleY = (_numLabels>0) ? labely + characterSize : labely; // Position the title at the middle of the bar above any labels. text->setPosition(osg::Vec3((_width/2.0f), titleY, 0.0f)*matrix);