1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:37:45 +00:00

LibCards+Games: Move mark_intersecting_stacks_dirty() to CardGame

As part of this, made a const overload for `Card::rect()`. We need the
non-const one too as it's used for modifying the position of a card
that's being dragged. I plan on changing that soon but we'll see.
This commit is contained in:
Sam Atkins 2022-09-28 14:18:44 +01:00 committed by Sam Atkins
parent 12612703f9
commit 5960c0556f
7 changed files with 12 additions and 22 deletions

View file

@ -22,6 +22,16 @@ void CardGame::add_stack(NonnullRefPtr<CardStack> stack)
m_stacks.append(move(stack));
}
void CardGame::mark_intersecting_stacks_dirty(Cards::Card const& intersecting_card)
{
for (auto& stack : stacks()) {
if (intersecting_card.rect().intersects(stack.bounding_box()))
update(stack.bounding_box());
}
update(intersecting_card.rect());
}
void CardGame::dump_layout() const
{
dbgln("------------------------------");