diff --git a/src/ui/material/draw_helpers.h b/src/ui/material/draw_helpers.h index 5306d20..9ff5a58 100644 --- a/src/ui/material/draw_helpers.h +++ b/src/ui/material/draw_helpers.h @@ -570,6 +570,18 @@ inline void DrawCardDropShadow(ImDrawList* dl, const ImVec2& pMin, const ImVec2& const float dp = Layout::dpiScale(); const int kRings = 12; const float spread = 14.0f * dp; // how far the shadow reaches beyond the card edge (all sides) + + // Cards live inside clipping child windows, so the shadow (which extends past the card edge) is + // otherwise cut off at the child boundary — most visibly on the sidebar's inner edge. Widen the + // clip HORIZONTALLY (to the card + spread, clamped to the viewport) so the side shadows reach into + // the gaps; keep the VERTICAL clip at the child bounds so a card scrolled to a child's top/bottom + // edge can't bleed its shadow into the header/footer above or below the scroll area. + ImGuiViewport* vp = ImGui::GetMainViewport(); + const ImVec2 cur0 = dl->GetClipRectMin(); + const ImVec2 cur1 = dl->GetClipRectMax(); + const float x0 = std::max(vp->Pos.x, std::min(cur0.x, pMin.x - spread)); + const float x1 = std::min(vp->Pos.x + vp->Size.x, std::max(cur1.x, pMax.x + spread)); + dl->PushClipRect(ImVec2(x0, cur0.y), ImVec2(x1, cur1.y), false); for (int i = kRings; i >= 1; --i) { float t = (float)i / (float)kRings; // 1 (outer) .. near 0 (by the card) float e = spread * t; // expansion at this ring @@ -579,6 +591,7 @@ inline void DrawCardDropShadow(ImDrawList* dl, const ImVec2& pMin, const ImVec2& ImVec2 smx(pMax.x + e, pMax.y + e); dl->AddRect(smn, smx, IM_COL32(0, 0, 0, a), rounding + e, 0, 2.0f * dp); } + dl->PopClipRect(); } inline void DrawGlassPanel(ImDrawList* dl, const ImVec2& pMin,