mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -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 <QPainter>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
|
#include "gamescene.h"
|
||||||
#include "carditem.h"
|
#include "carditem.h"
|
||||||
#include "carddragitem.h"
|
#include "carddragitem.h"
|
||||||
#include "carddatabase.h"
|
#include "carddatabase.h"
|
||||||
|
|
@ -369,6 +369,8 @@ void CardItem::resetState()
|
||||||
attachedCards.clear();
|
attachedCards.clear();
|
||||||
setTapped(false, false);
|
setTapped(false, false);
|
||||||
setDoesntUntap(false);
|
setDoesntUntap(false);
|
||||||
|
if (scene())
|
||||||
|
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,13 @@ void GameScene::registerAnimationItem(AbstractCardItem *card)
|
||||||
animationTimer->start(50, this);
|
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)
|
void GameScene::startRubberBand(const QPointF &selectionOrigin)
|
||||||
{
|
{
|
||||||
emit sigStartRubberBand(selectionOrigin);
|
emit sigStartRubberBand(selectionOrigin);
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ public:
|
||||||
void stopRubberBand();
|
void stopRubberBand();
|
||||||
|
|
||||||
void registerAnimationItem(AbstractCardItem *item);
|
void registerAnimationItem(AbstractCardItem *item);
|
||||||
|
void unregisterAnimationItem(AbstractCardItem *card);
|
||||||
public slots:
|
public slots:
|
||||||
void toggleZoneView(Player *player, const QString &zoneName, int numberCards);
|
void toggleZoneView(Player *player, const QString &zoneName, int numberCards);
|
||||||
void addRevealedZoneView(Player *player, CardZone *zone, const QList<ServerInfo_Card *> &cardList);
|
void addRevealedZoneView(Player *player, CardZone *zone, const QList<ServerInfo_Card *> &cardList);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue