Improve update behavior

- Suppress reflections
- Keep selection when updating the model

Change-Id: I0e165f0019c8c24802193f3a59902876d4cb5060
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2019-08-26 15:12:58 +02:00
parent ca7e6bd1b1
commit 00b29fd90d
18 changed files with 222 additions and 68 deletions

View File

@@ -61,12 +61,12 @@ AnimationCurve::AnimationCurve(const QEasingCurve &easing, const QPointF &start,
};
QVector<QPointF> points = easing.toCubicSpline();
int numSegments = points.count() / 3;
int numSegments = points.size() / 3;
Keyframe current;
Keyframe tmp(start);
current.setInterpolation(Keyframe::Interpolation::Bezier);
current.setInterpolation(Keyframe::Interpolation::Linear);
tmp.setInterpolation(Keyframe::Interpolation::Bezier);
for (int i = 0; i < numSegments; i++) {
@@ -80,6 +80,8 @@ AnimationCurve::AnimationCurve(const QEasingCurve &easing, const QPointF &start,
m_frames.push_back(current);
current.setInterpolation(tmp.interpolation());
tmp.setLeftHandle(p2);
tmp.setPosition(p3);
}
@@ -189,6 +191,14 @@ QPainterPath AnimationCurve::intersectionPath() const
return path;
}
Keyframe AnimationCurve::keyframeAt(size_t id) const
{
if (id >= m_frames.size())
return Keyframe();
return m_frames.at(id);
}
std::vector<Keyframe> AnimationCurve::keyframes() const
{
return m_frames;