Skip to content

Commit f73bb16

Browse files
trflynn89awesomekling
authored andcommitted
LibCards: Draw card stack background when the entire stack is moving
The stack background should be painted when the entire stack is being dragged, rather than just the top card. Fixes #7786. Regressed in 2b762ef.
1 parent f6d372b commit f73bb16

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Userland/Libraries/LibCards/CardStack.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ void CardStack::clear()
4545
void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color)
4646
{
4747
auto draw_background_if_empty = [&]() {
48+
size_t number_of_moving_cards = 0;
49+
for (const auto& card : m_stack)
50+
number_of_moving_cards += card.is_moving();
51+
4852
if (m_associated_stack && !m_associated_stack->is_empty())
4953
return false;
50-
if (!is_empty() && !(m_stack.size() == 1 && peek().is_moving()))
54+
if (!is_empty() && (m_stack.size() != number_of_moving_cards))
5155
return false;
5256
painter.fill_rect_with_rounded_corners(m_base, background_color.darkened(0.5), Card::card_radius);
5357
painter.fill_rect_with_rounded_corners(m_base.shrunken(2, 2), background_color, Card::card_radius - 1);

0 commit comments

Comments
 (0)