mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 13:33:55 -07:00
Changed anonymous namespace for static and braced functions
This commit is contained in:
parent
1cec15b42b
commit
0e1db47b85
2 changed files with 12 additions and 12 deletions
|
|
@ -8,14 +8,11 @@
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
namespace
|
static qreal stackingOffset(qreal cardHeight)
|
||||||
{
|
|
||||||
qreal stackingOffset(qreal cardHeight)
|
|
||||||
{
|
{
|
||||||
const qreal overlapPercent = SettingsCache::instance().getStackCardOverlapPercent();
|
const qreal overlapPercent = SettingsCache::instance().getStackCardOverlapPercent();
|
||||||
return cardHeight * (100.0 - overlapPercent) / 100.0;
|
return cardHeight * (100.0 - overlapPercent) / 100.0;
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
SelectZone::ZoneLayout SelectZone::computeZoneLayout(const StackLayoutParams ¶ms)
|
SelectZone::ZoneLayout SelectZone::computeZoneLayout(const StackLayoutParams ¶ms)
|
||||||
{
|
{
|
||||||
|
|
@ -56,13 +53,16 @@ SelectZone::ZoneLayout SelectZone::computeZoneLayout(const StackLayoutParams &pa
|
||||||
SelectZone *SelectZone::findOwningSelectZone(const QGraphicsItem *card)
|
SelectZone *SelectZone::findOwningSelectZone(const QGraphicsItem *card)
|
||||||
{
|
{
|
||||||
QGraphicsItem *parent = card ? card->parentItem() : nullptr;
|
QGraphicsItem *parent = card ? card->parentItem() : nullptr;
|
||||||
if (!parent)
|
if (!parent) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
// Card may be direct child of zone (escaped for hover) or child of clip container.
|
// Card may be direct child of zone (escaped for hover) or child of clip container.
|
||||||
if (auto *zone = dynamic_cast<SelectZone *>(parent))
|
if (auto *zone = dynamic_cast<SelectZone *>(parent)) {
|
||||||
return zone;
|
return zone;
|
||||||
if (auto *zone = dynamic_cast<SelectZone *>(parent->parentItem()))
|
}
|
||||||
|
if (auto *zone = dynamic_cast<SelectZone *>(parent->parentItem())) {
|
||||||
return zone;
|
return zone;
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,11 @@ protected:
|
||||||
/// Parameters describing a vertical card stack's geometry.
|
/// Parameters describing a vertical card stack's geometry.
|
||||||
struct StackLayoutParams
|
struct StackLayoutParams
|
||||||
{
|
{
|
||||||
int cardCount;
|
int cardCount; ///< Number of cards in the stack
|
||||||
qreal totalHeight;
|
qreal totalHeight; ///< Available height for the stack (zone height)
|
||||||
qreal cardHeight;
|
qreal cardHeight; ///< Height of a single card
|
||||||
qreal desiredOffset;
|
qreal desiredOffset; ///< Preferred vertical offset between card tops
|
||||||
qreal minOffset = 0.0;
|
qreal minOffset = 0.0; ///< Minimum offset to preserve (0 allows full compression)
|
||||||
/// When false (default), reserves full cardHeight for the bottom card, ensuring
|
/// When false (default), reserves full cardHeight for the bottom card, ensuring
|
||||||
/// all cards remain within zone bounds. When true, allows the bottom card to
|
/// all cards remain within zone bounds. When true, allows the bottom card to
|
||||||
/// partially overflow using sqrt-scaled allowance. Use with setupClipContainer()
|
/// partially overflow using sqrt-scaled allowance. Use with setupClipContainer()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue