change(themes): make the card shadow uniform (no directional offset)
Drop the downward offset so the soft shadow is equal on all four sides — an even halo around each card rather than a directional cast, matching the requested look. Slightly more rings for a smoother falloff. Still stroke-based (no body contamination), Light/Marble only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -561,22 +561,22 @@ inline bool CardDropShadowWanted()
|
||||
return s_want;
|
||||
}
|
||||
|
||||
// Soft drop shadow OUTSIDE a rounded rect, offset down. Drawn as fading rounded-rect STROKES (not
|
||||
// fills), so it never paints across the card body — only the outer blur remains once the card fill
|
||||
// covers the interior. This is the "render then mask out the UI area" result without an FBO.
|
||||
// Soft, UNIFORM shadow around a rounded rect — no directional offset, equal on all sides. Drawn as
|
||||
// fading rounded-rect STROKES (not fills), so it never paints across the card body — only the outer
|
||||
// blur remains once the card fill covers the interior. The "render then mask out the UI area" result
|
||||
// without an FBO.
|
||||
inline void DrawCardDropShadow(ImDrawList* dl, const ImVec2& pMin, const ImVec2& pMax, float rounding)
|
||||
{
|
||||
const float dp = Layout::dpiScale();
|
||||
const int kRings = 10;
|
||||
const float spread = 13.0f * dp; // how far the shadow reaches beyond the card edge
|
||||
const float offY = 3.0f * dp; // downward drop offset
|
||||
const int kRings = 12;
|
||||
const float spread = 14.0f * dp; // how far the shadow reaches beyond the card edge (all sides)
|
||||
for (int i = kRings; i >= 1; --i) {
|
||||
float t = (float)i / (float)kRings; // 1 (outer) .. 0.1 (near the card)
|
||||
float t = (float)i / (float)kRings; // 1 (outer) .. near 0 (by the card)
|
||||
float e = spread * t; // expansion at this ring
|
||||
int a = (int)(20.0f * (1.0f - t) + 0.5f); // alpha: ~0 at the outer edge, strongest by the card
|
||||
int a = (int)(18.0f * (1.0f - t) + 0.5f); // alpha: ~0 at the outer edge, strongest by the card
|
||||
if (a < 1) continue;
|
||||
ImVec2 smn(pMin.x - e, pMin.y - e + offY);
|
||||
ImVec2 smx(pMax.x + e, pMax.y + e + offY);
|
||||
ImVec2 smn(pMin.x - e, pMin.y - e);
|
||||
ImVec2 smx(pMax.x + e, pMax.y + e);
|
||||
dl->AddRect(smn, smx, IM_COL32(0, 0, 0, a), rounding + e, 0, 2.0f * dp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user