#3922 Scale bar : Update legend layout when dependent data changes

This commit is contained in:
Magne Sjaastad 2019-01-02 10:39:11 +01:00
parent 98c0406926
commit 4e6d7d3c40

View File

@ -625,6 +625,7 @@ void RiuViewer::updateLegendLayout()
int edgeAxisBorderWidth = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderWidth() : 0;
int edgeAxisBorderHeight = m_showWindowEdgeAxes ? m_windowEdgeAxisOverlay->frameBorderHeight() : 0;
{
int xPos = border + edgeAxisBorderWidth;
int yPos = border + edgeAxisBorderHeight;
@ -686,12 +687,18 @@ void RiuViewer::updateLegendLayout()
{
legend->setRenderSize(cvf::Vec2ui(maxColumnWidht, legend->renderSize().y()));
}
}
{
int margin = 5;
auto scaleLegendSize = m_scaleLegend->renderSize();
auto otherItemsHeight = m_versionInfoLabel->size().height();
m_scaleLegend->setLayoutFixedPosition({width() - (int)scaleLegendSize.x() - margin - edgeAxisBorderWidth,
margin + edgeAxisBorderHeight + margin + otherItemsHeight});
auto otherItemsHeight = m_versionInfoLabel->sizeHint().height();
const int xPos = width() - (int)scaleLegendSize.x() - margin - edgeAxisBorderWidth;
const int yPos = margin + edgeAxisBorderHeight + margin + otherItemsHeight;
m_scaleLegend->setLayoutFixedPosition({xPos, yPos});
}
}
//--------------------------------------------------------------------------------------------------
@ -908,7 +915,10 @@ void RiuViewer::showEdgeTickMarksXY(bool enable, bool showAxisLines)
m_windowEdgeAxisOverlay->setShowAxisLines(showAxisLines);
m_mainRendering->addOverlayItem(m_windowEdgeAxisOverlay.p());
}
m_showWindowEdgeAxes = enable;
updateLegendLayout();
}
//--------------------------------------------------------------------------------------------------
@ -925,7 +935,10 @@ void RiuViewer::showEdgeTickMarksXZ(bool enable, bool showAxisLines)
m_windowEdgeAxisOverlay->setShowAxisLines(showAxisLines);
m_mainRendering->addOverlayItem(m_windowEdgeAxisOverlay.p());
}
m_showWindowEdgeAxes = enable;
updateLegendLayout();
}
//--------------------------------------------------------------------------------------------------
@ -1039,6 +1052,8 @@ void RiuViewer::showScaleLegend(bool show)
{
m_mainRendering->removeOverlayItem(m_scaleLegend.p());
}
updateLegendLayout();
}
//--------------------------------------------------------------------------------------------------