mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
stop card tap/untap animation in CardItem::resetState() to avoid unfinished animation during zone change
This commit is contained in:
parent
eb6520a737
commit
ca3a7e69a1
3 changed files with 11 additions and 1 deletions
|
|
@ -2,8 +2,8 @@
|
|||
#include <QPainter>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include "gamescene.h"
|
||||
#include "carditem.h"
|
||||
#include "carddragitem.h"
|
||||
#include "carddatabase.h"
|
||||
|
|
@ -369,6 +369,8 @@ void CardItem::resetState()
|
|||
attachedCards.clear();
|
||||
setTapped(false, false);
|
||||
setDoesntUntap(false);
|
||||
if (scene())
|
||||
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,6 +262,13 @@ void GameScene::registerAnimationItem(AbstractCardItem *card)
|
|||
animationTimer->start(50, this);
|
||||
}
|
||||
|
||||
void GameScene::unregisterAnimationItem(AbstractCardItem *card)
|
||||
{
|
||||
cardsToAnimate.remove(static_cast<CardItem *>(card));
|
||||
if (cardsToAnimate.isEmpty())
|
||||
animationTimer->stop();
|
||||
}
|
||||
|
||||
void GameScene::startRubberBand(const QPointF &selectionOrigin)
|
||||
{
|
||||
emit sigStartRubberBand(selectionOrigin);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public:
|
|||
void stopRubberBand();
|
||||
|
||||
void registerAnimationItem(AbstractCardItem *item);
|
||||
void unregisterAnimationItem(AbstractCardItem *card);
|
||||
public slots:
|
||||
void toggleZoneView(Player *player, const QString &zoneName, int numberCards);
|
||||
void addRevealedZoneView(Player *player, CardZone *zone, const QList<ServerInfo_Card *> &cardList);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue