mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
make cards on the stack slightly overlap to stress order (#4930)
* make cards on the stack slightly overlap to stress order dragging cards to the stack now places the card at the location it is dropped * make default play action append to stack * add vertical overlap to settings and vertical hand * Update cockatrice/src/dlg_settings.cpp Co-authored-by: tooomm <tooomm@users.noreply.github.com> * Fix format --------- Co-authored-by: tooomm <tooomm@users.noreply.github.com> Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
This commit is contained in:
parent
28f80e18a0
commit
fa727524dc
11 changed files with 104 additions and 49 deletions
|
|
@ -2,10 +2,36 @@
|
|||
|
||||
#include "carditem.h"
|
||||
#include "gamescene.h"
|
||||
#include "settingscache.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
qreal divideCardSpaceInZone(qreal index, int cardCount, qreal totalHeight, qreal cardHeight, bool reverse)
|
||||
{
|
||||
qreal cardMinOverlap = cardHeight * SettingsCache::instance().getStackCardOverlapPercent() / 100;
|
||||
qreal desiredHeight = cardHeight * cardCount - cardMinOverlap * (cardCount - 1);
|
||||
qreal y;
|
||||
if (desiredHeight > totalHeight) {
|
||||
if (reverse) {
|
||||
y = index / ((totalHeight - cardHeight) / (cardCount - 1));
|
||||
} else {
|
||||
y = index * (totalHeight - cardHeight) / (cardCount - 1);
|
||||
}
|
||||
} else {
|
||||
qreal start = (totalHeight - desiredHeight) / 2;
|
||||
if (reverse) {
|
||||
if (index <= start) {
|
||||
return 0;
|
||||
}
|
||||
y = (index - start) / (cardHeight - cardMinOverlap);
|
||||
} else {
|
||||
y = index * (cardHeight - cardMinOverlap) + start;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
SelectZone::SelectZone(Player *_player,
|
||||
const QString &_name,
|
||||
bool _hasCardAttr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue