mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
game: Automatic update of arrow position (#5729)
Currently, zones must keep track of which cards they move in order to manually call `updatePath` on arrows. This patch sets the `ItemSendsScenePositionChanges` flag on `ArrowTarget`s to automatically update arrow positions without requiring zones to keep track of that information.
This commit is contained in:
parent
c99afe7956
commit
4ada011632
6 changed files with 19 additions and 32 deletions
|
|
@ -109,8 +109,6 @@ void StackZone::handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone
|
|||
void StackZone::reorganizeCards()
|
||||
{
|
||||
if (!cards.isEmpty()) {
|
||||
QSet<ArrowItem *> arrowsToUpdate;
|
||||
|
||||
const auto cardCount = static_cast<int>(cards.size());
|
||||
qreal totalWidth = boundingRect().width();
|
||||
qreal cardWidth = cards.at(0)->boundingRect().width();
|
||||
|
|
@ -125,16 +123,6 @@ void StackZone::reorganizeCards()
|
|||
divideCardSpaceInZone(i, cardCount, boundingRect().height(), cards.at(0)->boundingRect().height());
|
||||
card->setPos(x, y);
|
||||
card->setRealZValue(i);
|
||||
|
||||
for (ArrowItem *item : card->getArrowsFrom()) {
|
||||
arrowsToUpdate.insert(item);
|
||||
}
|
||||
for (ArrowItem *item : card->getArrowsTo()) {
|
||||
arrowsToUpdate.insert(item);
|
||||
}
|
||||
}
|
||||
for (ArrowItem *item : arrowsToUpdate) {
|
||||
item->updatePath();
|
||||
}
|
||||
}
|
||||
update();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue