Set background and frame color from the view plus update frame margins.

This commit is contained in:
Gaute Lindkvist
2018-04-06 11:52:29 +02:00
parent 507229f84b
commit 63ffade452
14 changed files with 90 additions and 51 deletions

View File

@@ -138,7 +138,7 @@ void CategoryLegend::renderGeneric(OpenGLContext* oglContext,
TextDrawer textDrawer(this->font());
setupTextDrawer(&textDrawer, &layout, &maxLegendRightPos);
Vec2f backgroundSize(CVF_MIN(maxLegendRightPos + 3.0f, (float)size.x()), (float)size.y());
Vec2f backgroundSize(CVF_MIN(maxLegendRightPos + layout.margins.x(), (float)size.x()), (float)size.y());
// Do the actual rendering
if (software)
@@ -482,7 +482,7 @@ void CategoryLegend::layoutInfo(OverlayColorLegendLayoutInfo* layout)
ref<Glyph> glyph = this->font()->getGlyph(L'A');
layout->charHeight = static_cast<float>(glyph->height());
layout->lineSpacing = layout->charHeight*1.5f;
layout->margins = Vec2f(4.0f, 4.0f);
layout->margins = Vec2f(8.0f, 8.0f);
float legendWidth = 25.0f;
float legendHeight = static_cast<float>(layout->size.y()) - 2 * layout->margins.y() - static_cast<float>(this->titleStrings().size())*layout->lineSpacing - layout->lineSpacing;

View File

@@ -192,7 +192,7 @@ void OverlayScalarMapperLegend::renderGeneric(OpenGLContext* oglContext, const V
TextDrawer textDrawer(this->font());
setupTextDrawer(&textDrawer, &layout, &maxLegendRightPos);
Vec2f backgroundSize(CVF_MIN(maxLegendRightPos + 3.0f, (float)size.x()), (float)size.y());
Vec2f backgroundSize(CVF_MIN(maxLegendRightPos + layout.margins.x(), (float)size.x()), (float)size.y());
// Do the actual rendering
if (software)
@@ -613,7 +613,7 @@ void OverlayScalarMapperLegend::layoutInfo(OverlayColorLegendLayoutInfo* layout)
ref<Glyph> glyph = this->font()->getGlyph(L'A');
layout->charHeight = static_cast<float>(glyph->height());
layout->lineSpacing = layout->charHeight*1.5f;
layout->margins = Vec2f(4.0f, 4.0f);
layout->margins = Vec2f(8.0f, 8.0f);
float legendWidth = 25.0f;
float legendHeight = static_cast<float>(layout->size.y()) - 2*layout->margins.y() - static_cast<float>(this->titleStrings().size())*layout->lineSpacing - layout->lineSpacing;