mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-03 20:13:56 -07:00
Display visual feedback of where cards will go (#5737)
This is part of the code from #4974, including an improved drag-and-drop API and its use to display visual feedback of card destination on the board. It does not include the improved logic for pushing cards around as I still need to figure out edge cases there - the logic for choosing where cards go is not changed, so some of the artifacts described in #4817 and #4975 (particularly around multi-card) are still present.
This commit is contained in:
parent
bd28e04635
commit
a7641a571f
6 changed files with 230 additions and 100 deletions
|
|
@ -77,6 +77,8 @@ private:
|
|||
*/
|
||||
bool active;
|
||||
|
||||
QGraphicsPathItem *m_feedbackItem = nullptr;
|
||||
|
||||
bool isInverted() const;
|
||||
|
||||
private slots:
|
||||
|
|
@ -118,6 +120,14 @@ public:
|
|||
*/
|
||||
void toggleTapped();
|
||||
|
||||
bool dragEnter(CardDragItem *dragItem, const QPointF &pos) override;
|
||||
|
||||
void dragMove(CardDragItem *dragItem, const QPointF &pos) override;
|
||||
|
||||
void dragAccept(CardDragItem *dragItem, const QPointF &pos) override;
|
||||
|
||||
void dragLeave(CardDragItem *dragItem) override;
|
||||
|
||||
/**
|
||||
See HandleDropEventByGrid
|
||||
*/
|
||||
|
|
@ -133,13 +143,6 @@ public:
|
|||
*/
|
||||
CardItem *getCardFromGrid(const QPoint &gridPoint) const;
|
||||
|
||||
/**
|
||||
@return CardItem from coordinate location
|
||||
*/
|
||||
CardItem *getCardFromCoords(const QPointF &point) const;
|
||||
|
||||
QPointF closestGridPoint(const QPointF &point) override;
|
||||
|
||||
static int clampValidTableRow(const int row);
|
||||
|
||||
/**
|
||||
|
|
@ -184,6 +187,8 @@ private:
|
|||
void paintZoneOutline(QPainter *painter);
|
||||
void paintLandDivider(QPainter *painter);
|
||||
|
||||
void updateFeedback(CardDragItem *dragItem, const QPointF &point);
|
||||
|
||||
/*
|
||||
Calculates card stack widths so mapping functions work properly
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue