BMenuItem: Round to prevent unneeded truncation
The case I fear is if frameWidth is 99.999999 and labelWidth is 100.0 it will attempt to perform a truncation unnecessarily.
This commit is contained in:
@@ -408,7 +408,7 @@ BMenuItem::DrawContent()
|
|||||||
const BRect& padding = menuPrivate.Padding();
|
const BRect& padding = menuPrivate.Padding();
|
||||||
float frameWidth = fSuper->Frame().Width() - padding.left - padding.right;
|
float frameWidth = fSuper->Frame().Width() - padding.left - padding.right;
|
||||||
|
|
||||||
if (frameWidth >= labelWidth)
|
if (roundf(frameWidth) >= roundf(labelWidth))
|
||||||
fSuper->DrawString(fLabel);
|
fSuper->DrawString(fLabel);
|
||||||
else {
|
else {
|
||||||
// truncate label to fit
|
// truncate label to fit
|
||||||
|
|||||||
Reference in New Issue
Block a user