mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-29 19:10:26 +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
Notes:
sideshowbarker
2024-07-18 16:52:22 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/f73bb164ad0 Pull-request: https://github.com/SerenityOS/serenity/pull/7787 Issue: https://github.com/SerenityOS/serenity/issues/7786
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)
|
void CardStack::draw(GUI::Painter& painter, const Gfx::Color& background_color)
|
||||||
{
|
{
|
||||||
auto draw_background_if_empty = [&]() {
|
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())
|
if (m_associated_stack && !m_associated_stack->is_empty())
|
||||||
return false;
|
return false;
|
||||||
if (!is_empty() && !(m_stack.size() == 1 && peek().is_moving()))
|
if (!is_empty() && (m_stack.size() != number_of_moving_cards))
|
||||||
return false;
|
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, 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);
|
painter.fill_rect_with_rounded_corners(m_base.shrunken(2, 2), background_color, Card::card_radius - 1);
|
||||||
|
|
Loading…
Reference in a new issue