mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
ScrollView: Add a subtle drop shadow to the top.
This commit is contained in:
1 parent
6b5d4fdd86
commit
3268d2afd0
1 file changed
+17
@@ -239,6 +239,23 @@ void ScrollView::Draw(UIContext &dc) {
|
||||
// For debugging layout issues, this can be useful.
|
||||
// dc.FillRect(Drawable(0x60FF00FF), bounds_);
|
||||
views_[0]->Draw(dc);
|
||||
|
||||
// If not anchored at the top of the screen exactly, and not scrolled to the top,
|
||||
// draw a subtle drop shadow to indicate scrollability.
|
||||
if (bounds_.y > 0.0f && orientation_ == ORIENT_VERTICAL) {
|
||||
float radius = 20.0f;
|
||||
|
||||
Bounds shadowBounds = bounds_;
|
||||
shadowBounds.x -= radius;
|
||||
shadowBounds.w += radius * 2;
|
||||
shadowBounds.y -= radius * 2;
|
||||
shadowBounds.h = radius * 2;
|
||||
|
||||
float fade = std::clamp(scrollPos_ * 0.1f, 0.0f, 0.6f);
|
||||
|
||||
dc.DrawRectDropShadow(shadowBounds, radius, fade);
|
||||
}
|
||||
|
||||
dc.PopScissor();
|
||||
|
||||
// Vertical scroll bob. We don't support a horizontal yet.
|
||||
|
||||
Reference in new issue
Block a user