mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-12 21:10:01 -08:00
Refactor vertical card stacking with clip containers for variable zone sizes (#6774)
* Refactor vertical card stacking with opt-in overflow for variable zone sizes Introduce a shared vertical stacking layout system in SelectZone that replaces the old divideCardSpaceInZone() free function with structured layout computation (StackLayoutParams, ZoneLayout, computeZoneLayout). By default, cards are guaranteed to fit within zone bounds (no overflow). Zones can opt-in to bottom overflow via allowBottomOverflow flag, with sqrt-scaled compression for smooth visual transitions. A clip container mechanism is available for future zones that need visual clipping. Key changes: - SelectZone: new layout engine with allowBottomOverflow opt-in; clip container infrastructure for future zones needing visual clipping - StackZone: uses new layout (no overflow); adds setHeight() for dynamic resizing capabilities - HandZone: vertical layout delegates to SelectZone's shared stacking - AbstractCardItem: preserves hover z-value during layout passes; invalidates scene rect on hover exit for proper sibling repainting - CardZone::onCardAdded made virtual for clip container reparenting - Zone widths updated to CardDimensions::WIDTH_F * 1.5 * Changed anonymous namespace for static and braced functions * CI tests re-run
This commit is contained in:
parent
5735a44a9a
commit
1a62f82aee
12 changed files with 402 additions and 111 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* @file card_zone.h
|
||||
* @ingroup GameGraphicsZones
|
||||
* @brief TODO: Document this.
|
||||
* @brief Base graphics item for zones that contain cards.
|
||||
*/
|
||||
|
||||
#ifndef CARDZONE_H
|
||||
|
|
@ -40,7 +40,10 @@ protected:
|
|||
}
|
||||
public slots:
|
||||
bool showContextMenu(const QPoint &screenPos);
|
||||
void onCardAdded(CardItem *addedCard);
|
||||
/// @brief Called when a card is added to this zone. Default: reparents card to this item.
|
||||
/// Virtual so subclasses (e.g. SelectZone) can override parenting behavior — the Qt signal
|
||||
/// connection in CardZone's constructor dispatches through the vtable.
|
||||
virtual void onCardAdded(CardItem *addedCard);
|
||||
|
||||
public:
|
||||
enum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue