#3698 Scale bar. Fixed axis length

This commit is contained in:
Bjørn Erik Jensen 2018-11-15 11:46:55 +01:00
parent d8a466a9ef
commit 05e04bb588

View File

@ -527,7 +527,7 @@ void OverlayScaleLegend::layoutInfo(LayoutInfo* layout)
layout->majorTickSize = 9.0f; layout->majorTickSize = 9.0f;
layout->minorTickSize = 5.0f; layout->minorTickSize = 5.0f;
float maxAxisLength = static_cast<float>(layout->overallLegendSize.y()) layout->axisLength = static_cast<float>(layout->overallLegendSize.y())
- 2*layout->margins.y() - 2*layout->margins.y()
- static_cast<float>(this->titleStrings().size()) * layout->lineSpacing - static_cast<float>(this->titleStrings().size()) * layout->lineSpacing
- layout->lineSpacing; - layout->lineSpacing;
@ -549,7 +549,7 @@ void OverlayScaleLegend::layoutInfo(LayoutInfo* layout)
double tickInDomain = m_ticksInDomain[i] + ((double)j * tickSpacingInDomain / 2.0); double tickInDomain = m_ticksInDomain[i] + ((double)j * tickSpacingInDomain / 2.0);
double tickInDisplay = tickInDomain * currentScale; double tickInDisplay = tickInDomain * currentScale;
if (tickInDisplay - layout->startPt.y() < maxAxisLength) if (tickInDisplay < layout->axisLength)
{ {
layout->ticks.emplace_back(LayoutInfo::Tick(tickInDisplay, tickInDomain, j == 0)); layout->ticks.emplace_back(LayoutInfo::Tick(tickInDisplay, tickInDomain, j == 0));
} }
@ -561,10 +561,7 @@ void OverlayScaleLegend::layoutInfo(LayoutInfo* layout)
} }
if (finished) break; if (finished) break;
} }
layout->axisLength = static_cast<float>(layout->ticks.back().displayValue);
} }
else
layout->axisLength = 0;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------