23Camera::Camera(
QPointF translation, qreal rotation, qreal scaling)
25 Q_ASSERT(scaling > 0);
26 mTranslate = translation;
29 updateViewTransform();
32Camera::Camera(
QPointF translation, qreal rotation, qreal scaling, CameraEasingType type)
35 Camera(translation, rotation, scaling);
40 mTranslate = c2.mTranslate;
43 mPathControlPoint = c2.mPathControlPoint;
44 mEasingType = c2.mEasingType;
45 mNeedUpdateView =
true;
52Camera* Camera::clone()
const
57void Camera::assign(
const Camera& rhs)
59 mTranslate = rhs.mTranslate;
60 mRotate = rhs.mRotate;
62 mPathControlPoint = rhs.mPathControlPoint;
63 mEasingType = rhs.mEasingType;
65 mNeedUpdateView =
true;
66 updateViewTransform();
73 updateViewTransform();
77void Camera::resetTransform()
82 mNeedUpdateView =
true;
86void Camera::updateViewTransform()
97 s.
scale(mScale, mScale);
101 mNeedUpdateView =
false;
104void Camera::translate(qreal dx, qreal dy)
109 mNeedUpdateView =
true;
113void Camera::translate(
const QPointF pt)
115 translate(pt.
x(), pt.
y());
118void Camera::rotate(qreal degree)
123 mRotate = mRotate - 360;
125 else if (mRotate < 0)
127 mRotate = mRotate + 360;
131 mNeedUpdateView =
true;
135void Camera::scale(qreal scaleValue)
139 mNeedUpdateView =
true;
143void Camera::setEasingType(CameraEasingType type)
149void Camera::setPathControlPoint(
QPointF point)
151 mPathControlPoint = point;
155void Camera::setPathControlPointMoved(
bool moved)
157 mPathControlPointMoved = moved;
161bool Camera::compare(
const Camera& rhs)
const
163 return ((mTranslate == rhs.mTranslate)
164 && qFuzzyCompare(mRotate, rhs.mRotate)
165 && qFuzzyCompare(mScale, rhs.mScale));