Removed inline logic
Removed inline logic to static variable, slight performance increase.
This commit is contained in:
parent
2a15b9c95a
commit
80fd0fbcf3
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,9 @@
|
||||||
#include <QGraphicsSceneMouseEvent>
|
#include <QGraphicsSceneMouseEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
static const float CARD_WIDTH_HALF = CARD_WIDTH / 2;
|
||||||
|
static const float CARD_HEIGHT_HALF = CARD_HEIGHT / 2;
|
||||||
|
|
||||||
AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag)
|
AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag)
|
||||||
: QGraphicsItem(), item(_item), hotSpot(_hotSpot)
|
: QGraphicsItem(), item(_item), hotSpot(_hotSpot)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +25,7 @@ AbstractCardDragItem::AbstractCardDragItem(AbstractCardItem *_item, const QPoint
|
||||||
setZValue(2000000007);
|
setZValue(2000000007);
|
||||||
}
|
}
|
||||||
if (item->getTapped())
|
if (item->getTapped())
|
||||||
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
|
setTransform(QTransform().translate(CARD_WIDTH_HALF, CARD_HEIGHT_HALF).rotate(90).translate(-CARD_WIDTH_HALF, -CARD_HEIGHT_HALF));
|
||||||
|
|
||||||
setCacheMode(DeviceCoordinateCache);
|
setCacheMode(DeviceCoordinateCache);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue