Commit 3c03c6f7 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Bug fix in the view reframing of the GLViewer on the newly displayed items.

parent 50c61799
......@@ -998,19 +998,19 @@ void GLViewer::paintGL()
renderCoords( c.x(), c.y(), c.z(), &textX, &textY );
QString label = m_BelowCursor->displayable->label();
QFont fonte( font().family(), font().pointSize(), QFont::Bold );
QFontMetrics fm( fonte );
QFont f( font().family(), 10, QFont::Bold );
QFontMetrics fm( f );
textY -= 0.5*fm.height();
textX -= 0.5*fm.width( label );
glColor3ub( 220, 220, 220 );
renderText( textX-1, textY-1, label, fonte );
renderText( textX-1, textY+1, label, fonte );
renderText( textX+1, textY-1, label, fonte );
renderText( textX+1, textY+1, label, fonte );
renderText( textX-1, textY-1, label, f );
renderText( textX-1, textY+1, label, f );
renderText( textX+1, textY-1, label, f );
renderText( textX+1, textY+1, label, f );
glColor3ub( 64, 64, 64 );
renderText( textX, textY, label, fonte );
renderText( textX, textY, label, f );
}
// Display the selection tool, if selection mode is enabled.
......@@ -1108,8 +1108,8 @@ void GLViewer::displayLabel( DisplayableInterface *d )
QVector3D bottomLeft = toViewportCoord.map( QVector3D( box.Min().x(), box.Min().y(), 0.0f ) );
QVector3D topRight = toViewportCoord.map( QVector3D( box.Max().x(), box.Max().y(), 0.0f ) );
QFont fonte( font().family(), font().pointSize(), QFont::Bold );
QFontMetrics fm( fonte );
QFont f( font().family(), 10, QFont::Bold );
QFontMetrics fm( f );
QString imgName;
int imgNameWidth;
......@@ -1137,12 +1137,12 @@ void GLViewer::displayLabel( DisplayableInterface *d )
int textY = bottomLeft.y() - fm.descent() - 2;
glColor3ub( 220, 220, 220 );
renderText( textX-1, textY-1, imgName, fonte );
renderText( textX-1, textY+1, imgName, fonte );
renderText( textX+1, textY-1, imgName, fonte );
renderText( textX+1, textY+1, imgName, fonte );
renderText( textX-1, textY-1, imgName, f );
renderText( textX-1, textY+1, imgName, f );
renderText( textX+1, textY-1, imgName, f );
renderText( textX+1, textY+1, imgName, f );
glColor3ub( 64, 64, 64 );
renderText( textX, textY, imgName, fonte );
renderText( textX, textY, imgName, f );
}
}
}
......
......@@ -536,7 +536,8 @@ void UIMainWindow::modifyItem( QTreeWidgetItem* entryInTable )
void UIMainWindow::modifyVisibility( const QList<QTreeWidgetItem*>& entriesInTable )
{
bool noDisplayableBefore = m_CurrentViewer->getDisplayables().empty();
int previousDisplayedCount = (int) m_CurrentViewer->getDisplayables().size();
int nActivatedDisplays = 0;
for( auto entry : entriesInTable )
{
......@@ -546,13 +547,19 @@ void UIMainWindow::modifyVisibility( const QList<QTreeWidgetItem*>& entriesInTab
m_CurrentViewer->isDisplayed(item) != (entry->checkState(0) == Qt::Checked) )
{
if( !m_CurrentViewer->isDisplayed(item) )
{
m_CurrentViewer->addDisplayable( item );
nActivatedDisplays ++;
}
else
m_CurrentViewer->removeDisplayable( item );
}
}
if( noDisplayableBefore && !m_CurrentViewer->getDisplayables().empty() )
int newDisplayedCount = (int) m_CurrentViewer->getDisplayables().size();
if( (previousDisplayedCount == 0 && newDisplayedCount != 0) ||
(previousDisplayedCount != 0 && newDisplayedCount == 1 && nActivatedDisplays != 0) )
reframeScene();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment