diff --git a/cockatrice/src/game/zones/select_zone.cpp b/cockatrice/src/game/zones/select_zone.cpp index 5291ea138..fd733e01f 100644 --- a/cockatrice/src/game/zones/select_zone.cpp +++ b/cockatrice/src/game/zones/select_zone.cpp @@ -8,14 +8,11 @@ #include #include -namespace -{ -qreal stackingOffset(qreal cardHeight) +static qreal stackingOffset(qreal cardHeight) { const qreal overlapPercent = SettingsCache::instance().getStackCardOverlapPercent(); return cardHeight * (100.0 - overlapPercent) / 100.0; } -} // namespace SelectZone::ZoneLayout SelectZone::computeZoneLayout(const StackLayoutParams ¶ms) { @@ -56,13 +53,16 @@ SelectZone::ZoneLayout SelectZone::computeZoneLayout(const StackLayoutParams &pa SelectZone *SelectZone::findOwningSelectZone(const QGraphicsItem *card) { QGraphicsItem *parent = card ? card->parentItem() : nullptr; - if (!parent) + if (!parent) { return nullptr; + } // Card may be direct child of zone (escaped for hover) or child of clip container. - if (auto *zone = dynamic_cast(parent)) + if (auto *zone = dynamic_cast(parent)) { return zone; - if (auto *zone = dynamic_cast(parent->parentItem())) + } + if (auto *zone = dynamic_cast(parent->parentItem())) { return zone; + } return nullptr; } diff --git a/cockatrice/src/game/zones/select_zone.h b/cockatrice/src/game/zones/select_zone.h index 9f9d9cb6b..1da5c1988 100644 --- a/cockatrice/src/game/zones/select_zone.h +++ b/cockatrice/src/game/zones/select_zone.h @@ -50,11 +50,11 @@ protected: /// Parameters describing a vertical card stack's geometry. struct StackLayoutParams { - int cardCount; - qreal totalHeight; - qreal cardHeight; - qreal desiredOffset; - qreal minOffset = 0.0; + int cardCount; ///< Number of cards in the stack + qreal totalHeight; ///< Available height for the stack (zone height) + qreal cardHeight; ///< Height of a single card + qreal desiredOffset; ///< Preferred vertical offset between card tops + qreal minOffset = 0.0; ///< Minimum offset to preserve (0 allows full compression) /// When false (default), reserves full cardHeight for the bottom card, ensuring /// all cards remain within zone bounds. When true, allows the bottom card to /// partially overflow using sqrt-scaled allowance. Use with setupClipContainer()