[Gui] Fix color bar position and text (#10552)

* [Gui] Fix ColorBar position and labelling

* [Gui] Improve formatting

* [Gui] ColorBar adjusts if user squashes window height

* [Gui] Changes following feedback
This commit is contained in:
Syres916
2023-09-20 00:35:22 +01:00
committed by GitHub
parent b2d255e5fc
commit 0c96b7d903
4 changed files with 172 additions and 12 deletions

View File

@@ -123,15 +123,23 @@ float SoFCColorBarBase::getBounds(const SbVec2s& size, float& fMinX, float&fMinY
// The cam height is set in SoFCColorBarBase::getBoundingWidth to 10.
// Therefore the normalized coordinates are in the range [-5, +5] x [-5ratio, +5ratio] if ratio > 1
// and [-5ratio, +5ratio] x [-5, +5] if ratio < 1.
// We don't want the whole height covered by the color bar (to have e.g space to the axis cross)
// thus we take as base 4.
float baseYValue = 4.0f;
// We don't want the whole height covered by the color bar (to have e.g space to the axis cross
// and the Navigation Cube) thus we take as base 3 or if the height reduces significantly it is 2.5.
float baseYValue;
if (fRatio > 3.0f) {
baseYValue = 2.5f;
}
else {
baseYValue = 3.0f;
}
float barWidth = 0.5f;
// we want the color bar at the rightmost position, therefore we take 5 as base
fMinX = 5.0f * fRatio; // must be scaled with the ratio to assure it stays at the right
// we want the color bar at the rightmost position, therefore we take 4.95 as base
fMinX = 4.95f * fRatio; // must be scaled with the ratio to assure it stays at the right
fMaxX = fMinX + barWidth;
fMinY = -baseYValue;
fMinY = -baseYValue - 0.6f; // Extend shortened bar towards axis cross
fMaxY = baseYValue; // bar has the height of almost whole window height
if (fRatio < 1.0f) {