support rewind
svn path=/trunk/KDE/kdelibs/; revision=1059028
This commit is contained in:
parent
4be6442625
commit
ee20613e3d
@ -63,7 +63,7 @@ void SlideAnimation::updateCurrentTime(int currentTime)
|
|||||||
QGraphicsWidget *w = widgetToAnimate();
|
QGraphicsWidget *w = widgetToAnimate();
|
||||||
if (w && state() == QAbstractAnimation::Running) {
|
if (w && state() == QAbstractAnimation::Running) {
|
||||||
qreal delta = currentTime / qreal(duration());
|
qreal delta = currentTime / qreal(duration());
|
||||||
w->setPos(m_startPos * (1-delta) + (m_target * delta));
|
w->setPos(m_startPos * (1-delta) + (m_targetPos * delta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,43 +78,43 @@ void SlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAn
|
|||||||
qreal newX = m_startPos.x();
|
qreal newX = m_startPos.x();
|
||||||
qreal newY = m_startPos.y();
|
qreal newY = m_startPos.y();
|
||||||
|
|
||||||
kDebug()<<movementDirection();
|
int actualDistance = (direction() == QAbstractAnimation::Forward?distance():-distance());
|
||||||
switch (movementDirection()) {
|
switch (movementDirection()) {
|
||||||
case MoveUp:
|
case MoveUp:
|
||||||
newY -= distance();
|
newY -= actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveRight:
|
case MoveRight:
|
||||||
newX += distance();
|
newX += actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveDown:
|
case MoveDown:
|
||||||
newY += distance();
|
newY += actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveLeft:
|
case MoveLeft:
|
||||||
newX -= distance();
|
newX -= actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveUpRight:
|
case MoveUpRight:
|
||||||
newX += distance();
|
newX += actualDistance;
|
||||||
newY -= distance();
|
newY -= actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveDownRight:
|
case MoveDownRight:
|
||||||
newX += distance();
|
newX += actualDistance;
|
||||||
newY += distance();
|
newY += actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoveDownLeft:
|
case MoveDownLeft:
|
||||||
newX -= distance();
|
newX -= actualDistance;
|
||||||
newY += distance();
|
newY += actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case MoveUpLeft:
|
case MoveUpLeft:
|
||||||
newX -= distance();
|
newX -= actualDistance;
|
||||||
newY -= distance();
|
newY -= actualDistance;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -122,7 +122,12 @@ void SlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAn
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_target = QPointF(newX, newY);
|
if (direction() == QAbstractAnimation::Forward) {
|
||||||
|
m_targetPos = QPointF(newX, newY);
|
||||||
|
} else {
|
||||||
|
m_targetPos = m_startPos;
|
||||||
|
m_startPos = QPointF(newX, newY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ private:
|
|||||||
qreal m_animDistance;
|
qreal m_animDistance;
|
||||||
|
|
||||||
QPointF m_startPos;
|
QPointF m_startPos;
|
||||||
QPointF m_target;
|
QPointF m_targetPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user