mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
* 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
32 lines
907 B
C++
32 lines
907 B
C++
/**
|
|
* @file stack_zone.h
|
|
* @ingroup GameGraphicsZones
|
|
* @brief Graphical zone for the stack, displaying cards in a vertical pile.
|
|
*/
|
|
|
|
#ifndef STACKZONE_H
|
|
#define STACKZONE_H
|
|
|
|
#include "logic/stack_zone_logic.h"
|
|
#include "select_zone.h"
|
|
|
|
class StackZone : public SelectZone
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
qreal zoneHeight;
|
|
private slots:
|
|
void updateBg();
|
|
|
|
public:
|
|
StackZone(StackZoneLogic *_logic, int _zoneHeight, QGraphicsItem *parent);
|
|
/// @brief Resizes the stack zone height, e.g. when sharing vertical space with the command zone.
|
|
void setHeight(qreal newHeight);
|
|
void
|
|
handleDropEvent(const QList<CardDragItem *> &dragItems, CardZoneLogic *startZone, const QPoint &dropPoint) override;
|
|
QRectF boundingRect() const override;
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
void reorganizeCards() override;
|
|
};
|
|
|
|
#endif
|