forked from qt-creator/qt-creator
QmlDesigner: Add enablers for frame scaling, moving
Change-Id: I24777f47f2f3826a21c7f5dd9984372b1738d2e3 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -65,6 +65,9 @@ public:
|
||||
|
||||
static bool isValidKeyframe(const ModelNode &node);
|
||||
static QmlTimelineFrames keyframesForKeyframe(const ModelNode &node);
|
||||
|
||||
void moveAllFrames(qreal offset);
|
||||
void scaleAllFrames(qreal factor);
|
||||
};
|
||||
|
||||
} //QmlDesigner
|
||||
|
@@ -57,6 +57,9 @@ public:
|
||||
qreal minActualFrame(const ModelNode &target) const;
|
||||
qreal maxActualFrame(const ModelNode &target) const;
|
||||
|
||||
void moveAllFrames(const ModelNode &target, qreal offset);
|
||||
void scaleAllFrames(const ModelNode &target, qreal factor);
|
||||
|
||||
QList<ModelNode> allTargets() const;
|
||||
QList<QmlTimelineFrames> framesForTarget(const ModelNode &target) const;
|
||||
void destroyFramesForTarget(const ModelNode &target);
|
||||
|
@@ -182,4 +182,23 @@ QmlTimelineFrames QmlTimelineFrames::keyframesForKeyframe(const ModelNode &node)
|
||||
return QmlTimelineFrames();
|
||||
}
|
||||
|
||||
void QmlTimelineFrames::moveAllFrames(qreal offset)
|
||||
{
|
||||
for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) {
|
||||
auto property = childNode.variantProperty("frame");
|
||||
if (property.isValid())
|
||||
property.setValue(property.value().toReal() + offset);
|
||||
}
|
||||
}
|
||||
|
||||
void QmlTimelineFrames::scaleAllFrames(qreal factor)
|
||||
{
|
||||
for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) {
|
||||
auto property = childNode.variantProperty("frame");
|
||||
|
||||
if (property.isValid())
|
||||
property.setValue(property.value().toReal() * factor);
|
||||
}
|
||||
}
|
||||
|
||||
} // QmlDesigner
|
||||
|
@@ -156,6 +156,19 @@ qreal QmlTimelineMutator::maxActualFrame(const ModelNode &target) const
|
||||
return max;
|
||||
}
|
||||
|
||||
void QmlTimelineMutator::moveAllFrames(const ModelNode &target, qreal offset)
|
||||
{
|
||||
for (QmlTimelineFrames &frames : framesForTarget(target))
|
||||
frames.moveAllFrames(offset);
|
||||
|
||||
}
|
||||
|
||||
void QmlTimelineMutator::scaleAllFrames(const ModelNode &target, qreal factor)
|
||||
{
|
||||
for (QmlTimelineFrames &frames : framesForTarget(target))
|
||||
frames.scaleAllFrames(factor);
|
||||
}
|
||||
|
||||
QList<ModelNode> QmlTimelineMutator::allTargets() const
|
||||
{
|
||||
QList<ModelNode> result;
|
||||
|
Reference in New Issue
Block a user