BColorControl: Position text controls better

Position the text control vertically in the middle of the ramp in
the case that the text controls are pushed down so that the red, green,
and blue text controls are next to the red, green, and blue ramps.
This commit is contained in:
John Scipione
2013-06-10 19:15:11 -04:00
parent d5432ed609
commit 1f0b41ba7f
+9 -8
View File
@@ -196,16 +196,17 @@ BColorControl::_LayoutView()
fPaletteFrame.bottom -= 1;
}
BRect rect = fPaletteFrame.InsetByCopy(-kBevelSpacing, -kBevelSpacing);
// frame including bevel
float offset = floorf(rect.bottom / 4);
float y = offset;
if (offset < _TextRectOffset()) {
offset = _TextRectOffset();
y = 0;
float rampHeight = (float)(fRows * fCellSize / kRampCount);
float offset = _TextRectOffset();
float y = 0;
if (rampHeight > fRedText->Frame().Height()) {
// there is enough room to fit kRampCount labels,
// shift text controls down by one ramp
offset = rampHeight;
y = floorf(offset + (offset - fRedText->Frame().Height()) / 2);
}
BRect rect = _PaletteFrame();
fRedText->MoveTo(rect.right + kTextFieldsHSpacing, y);
y += offset;