Tracker/CountView: correct invalidation of text area
Strings used for other languages may have descenders, and for some fonts and characters (like italics) the edges may go out of the escapement. On top of that, `TextAndBarberPoleRect()` doesn't include the whole barber pole area. Fixes: #18058, possibly #17901 Change-Id: I940676eaff9485969dac4f1d56bd6243e3d19581 Reviewed-on: https://review.haiku-os.org/c/haiku/+/11257 Tested-by: Commit checker robot <[email protected]> Haiku-Format: Haiku-format Bot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
2d2a1db5fc
commit
0d2f93c47b
@@ -105,7 +105,7 @@ BCountView::TrySpinningBarberPole()
|
||||
// After this the text needs no updating since only the pole changes.
|
||||
if (fStartSpinningAfter) {
|
||||
fStartSpinningAfter = 0;
|
||||
Invalidate(TextAndBarberPoleRect());
|
||||
Invalidate();
|
||||
} else
|
||||
Invalidate(BarberPoleInnerRect());
|
||||
}
|
||||
@@ -163,25 +163,15 @@ BCountView::BarberPoleOuterRect() const
|
||||
|
||||
|
||||
BRect
|
||||
BCountView::TextInvalRect() const
|
||||
{
|
||||
BRect result = TextAndBarberPoleRect();
|
||||
|
||||
// if the barber pole is not present, use its space for text
|
||||
if (fShowingBarberPole)
|
||||
result.right -= 10;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
BRect
|
||||
BCountView::TextAndBarberPoleRect() const
|
||||
BCountView::TextRect() const
|
||||
{
|
||||
BRect result = Bounds();
|
||||
result.InsetBy(be_control_look->ComposeSpacing(B_USE_SMALL_SPACING) / 2,
|
||||
floorf(result.Height() * 0.25f));
|
||||
|
||||
if (fShowingBarberPole)
|
||||
result.right -= 10;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -201,12 +191,8 @@ BCountView::CheckCount()
|
||||
invalidate = true;
|
||||
}
|
||||
|
||||
// invalidate the count text area if necessary
|
||||
if (invalidate)
|
||||
Invalidate(TextInvalRect());
|
||||
|
||||
// invalidate barber pole area if necessary
|
||||
TrySpinningBarberPole();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +249,7 @@ BCountView::Draw(BRect updateRect)
|
||||
}
|
||||
}
|
||||
|
||||
BRect textRect(TextInvalRect());
|
||||
BRect textRect(TextRect());
|
||||
|
||||
// leave room for pop up indicator
|
||||
float popUpWidth = be_control_look->DefaultItemSpacing();
|
||||
|
||||
@@ -76,8 +76,7 @@ public:
|
||||
private:
|
||||
BRect BarberPoleInnerRect() const;
|
||||
BRect BarberPoleOuterRect() const;
|
||||
BRect TextInvalRect() const;
|
||||
BRect TextAndBarberPoleRect() const;
|
||||
BRect TextRect() const;
|
||||
void TrySpinningBarberPole();
|
||||
|
||||
int32 fLastCount;
|
||||
|
||||
Reference in New Issue
Block a user