mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
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 2b762ef940
.
This commit is contained in:
parent
f6d372b2ab
commit
f73bb164ad
1 changed files with 5 additions and 1 deletions
|
@ -45,9 +45,13 @@ void CardStack::clear()
|
|||
void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color)
|
||||
{
|
||||
auto draw_background_if_empty = [&]() {
|
||||
size_t number_of_moving_cards = 0;
|
||||
for (const auto& card : m_stack)
|
||||
number_of_moving_cards += card.is_moving();
|
||||
|
||||
if (m_associated_stack && !m_associated_stack->is_empty())
|
||||
return false;
|
||||
if (!is_empty() && !(m_stack.size() == 1 && peek().is_moving()))
|
||||
if (!is_empty() && (m_stack.size() != number_of_moving_cards))
|
||||
return false;
|
||||
painter.fill_rect_with_rounded_corners(m_base, background_color.darkened(0.5), Card::card_radius);
|
||||
painter.fill_rect_with_rounded_corners(m_base.shrunken(2, 2), background_color, Card::card_radius - 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue