mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
add padding to right side of card reveal window (#5198)
This commit is contained in:
parent
0ca8bdb3a8
commit
f2b0fa164e
2 changed files with 12 additions and 8 deletions
|
|
@ -145,28 +145,29 @@ void ZoneViewZone::reorganizeCards()
|
|||
}
|
||||
|
||||
lastCardType = cardType;
|
||||
qreal x = 7 + (typeColumn * CARD_WIDTH);
|
||||
qreal x = typeColumn * CARD_WIDTH;
|
||||
qreal y = typeRow * CARD_HEIGHT / 3;
|
||||
c->setPos(x + 5, y + 5);
|
||||
c->setPos(HORIZONTAL_PADDING + x, VERTICAL_PADDING + y);
|
||||
c->setRealZValue(i);
|
||||
longestRow = qMax(typeRow, longestRow);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < cardCount; i++) {
|
||||
CardItem *c = cardsToDisplay.at(i);
|
||||
qreal x = 7 + ((i / rows) * CARD_WIDTH);
|
||||
qreal x = (i / rows) * CARD_WIDTH;
|
||||
qreal y = (i % rows) * CARD_HEIGHT / 3;
|
||||
c->setPos(x + 5, y + 5);
|
||||
c->setPos(HORIZONTAL_PADDING + x, VERTICAL_PADDING + y);
|
||||
c->setRealZValue(i);
|
||||
}
|
||||
}
|
||||
|
||||
int totalRows = (pileView && sortByType) ? longestRow : rows;
|
||||
int totalColumns = (pileView && sortByType) ? qMax(typeColumn + 1, 3) : qMax(cols, 1);
|
||||
|
||||
qreal aleft = 0;
|
||||
qreal atop = 0;
|
||||
qreal awidth = (pileView && sortByType) ? qMax(typeColumn + 1, 3) * CARD_WIDTH + (CARD_WIDTH / 2)
|
||||
: qMax(cols, 1) * CARD_WIDTH + (CARD_WIDTH / 2);
|
||||
qreal aheight = (pileView && sortByType) ? (longestRow * CARD_HEIGHT) / 3 + CARD_HEIGHT * 1.3
|
||||
: (rows * CARD_HEIGHT) / 3 + CARD_HEIGHT * 1.3;
|
||||
qreal awidth = totalColumns * CARD_WIDTH + (CARD_WIDTH / 2) + HORIZONTAL_PADDING;
|
||||
qreal aheight = (totalRows * CARD_HEIGHT) / 3 + CARD_HEIGHT * 1.3;
|
||||
optimumRect = QRectF(aleft, atop, awidth, aheight);
|
||||
|
||||
updateGeometry();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ class ZoneViewZone : public SelectZone, public QGraphicsLayoutItem
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(QGraphicsLayoutItem)
|
||||
private:
|
||||
static constexpr int HORIZONTAL_PADDING = 12;
|
||||
static constexpr int VERTICAL_PADDING = 5;
|
||||
|
||||
QRectF bRect, optimumRect;
|
||||
int minRows, numberCards;
|
||||
void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue