mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -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
|
|
@ -157,8 +157,6 @@ void TableZone::handleDropEventByGrid(const QList<CardDragItem *> &dragItems,
|
|||
|
||||
void TableZone::reorganizeCards()
|
||||
{
|
||||
QSet<ArrowItem *> arrowsToUpdate;
|
||||
|
||||
// Calculate card stack widths so mapping functions work properly
|
||||
computeCardStackWidths();
|
||||
|
||||
|
|
@ -189,23 +187,7 @@ void TableZone::reorganizeCards()
|
|||
qreal childY = y + 5;
|
||||
attachedCard->setPos(childX, childY);
|
||||
attachedCard->setRealZValue((childY + CARD_HEIGHT) * 100000 + (childX + 1) * 100);
|
||||
for (ArrowItem *item : attachedCard->getArrowsFrom()) {
|
||||
arrowsToUpdate.insert(item);
|
||||
}
|
||||
for (ArrowItem *item : attachedCard->getArrowsTo()) {
|
||||
arrowsToUpdate.insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
for (ArrowItem *item : cards[i]->getArrowsFrom()) {
|
||||
arrowsToUpdate.insert(item);
|
||||
}
|
||||
for (ArrowItem *item : cards[i]->getArrowsTo()) {
|
||||
arrowsToUpdate.insert(item);
|
||||
}
|
||||
}
|
||||
for (ArrowItem *item : arrowsToUpdate) {
|
||||
item->updatePath();
|
||||
}
|
||||
|
||||
resizeToContents();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue