#2730 Category and Scalarmapper Legend: Improve the preferred size

This commit is contained in:
Jacob Støren 2018-05-04 13:21:56 +02:00
parent df6c9f69d1
commit d413df0aeb
3 changed files with 7 additions and 3 deletions

View File

@ -257,5 +257,5 @@ void RivTernarySaturationOverlayItem::setRangeText(const cvf::String& soilRange,
//--------------------------------------------------------------------------------------------------
cvf::Vec2ui RivTernarySaturationOverlayItem::preferredSize()
{
return {120, 150}; // Could do more elaborate text width checks.
return {140, 180}; // Could do more elaborate text width checks.
}

View File

@ -503,7 +503,9 @@ cvf::Vec2ui CategoryLegend::preferredSize()
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
layoutInfo(&layout);
float prefferredYSize = 2*layout.margins.y() + (this->titleStrings().size() + m_categoryMapper->categoryCount() + 1)* layout.lineSpacing ;
float prefferredYSize = 2 * layout.margins.y()
+ layout.lineSpacing * (this->titleStrings().size())
+ 1.5f * layout.lineSpacing * (m_categoryMapper->categoryCount() + 1);
unsigned int maxTickTextWidth = 0;
for (size_t cIdx = 0; cIdx < m_categoryMapper->categoryCount(); ++cIdx )

View File

@ -687,7 +687,9 @@ cvf::Vec2ui OverlayScalarMapperLegend::preferredSize()
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
layoutInfo(&layout);
float prefferredYSize = 2*layout.margins.y() + (this->titleStrings().size() + m_tickValues.size() )* layout.lineSpacing ;
float prefferredYSize = 2 * layout.margins.y()
+ layout.lineSpacing * this->titleStrings().size()
+ 1.5f * layout.lineSpacing * m_tickValues.size();
unsigned int maxTickTextWidth = 0;
for (double tickValue : m_tickValues )