mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2730 Category and Scalarmapper Legend: Improve the preferred size
This commit is contained in:
parent
df6c9f69d1
commit
d413df0aeb
@ -257,5 +257,5 @@ void RivTernarySaturationOverlayItem::setRangeText(const cvf::String& soilRange,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::Vec2ui RivTernarySaturationOverlayItem::preferredSize()
|
cvf::Vec2ui RivTernarySaturationOverlayItem::preferredSize()
|
||||||
{
|
{
|
||||||
return {120, 150}; // Could do more elaborate text width checks.
|
return {140, 180}; // Could do more elaborate text width checks.
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,9 @@ cvf::Vec2ui CategoryLegend::preferredSize()
|
|||||||
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
|
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
|
||||||
layoutInfo(&layout);
|
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;
|
unsigned int maxTickTextWidth = 0;
|
||||||
for (size_t cIdx = 0; cIdx < m_categoryMapper->categoryCount(); ++cIdx )
|
for (size_t cIdx = 0; cIdx < m_categoryMapper->categoryCount(); ++cIdx )
|
||||||
|
@ -687,7 +687,9 @@ cvf::Vec2ui OverlayScalarMapperLegend::preferredSize()
|
|||||||
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
|
OverlayColorLegendLayoutInfo layout({200,200}); // Use default size
|
||||||
layoutInfo(&layout);
|
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;
|
unsigned int maxTickTextWidth = 0;
|
||||||
for (double tickValue : m_tickValues )
|
for (double tickValue : m_tickValues )
|
||||||
|
Loading…
Reference in New Issue
Block a user