text: minor refactoring to make rect setting code more reusable
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "config/config.h"
|
||||
#include "core.h"
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "node/generator/shape/shapenodebase.h"
|
||||
#include "node/project/project.h"
|
||||
#include "render/rendermanager.h"
|
||||
#include "task/taskmanager.h"
|
||||
@@ -480,7 +481,7 @@ void ViewerWidget::UpdateAudioProcessor()
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::CreateAddableAt(QRectF f)
|
||||
void ViewerWidget::CreateAddableAt(const QRectF &f)
|
||||
{
|
||||
if (Sequence *s = dynamic_cast<Sequence*>(GetConnectedNode())) {
|
||||
Track::Type type = Track::kVideo;
|
||||
@@ -510,12 +511,13 @@ void ViewerWidget::CreateAddableAt(QRectF f)
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize around center of sequence
|
||||
f.translate(-s->GetVideoParams().width()*0.5, -s->GetVideoParams().height()*0.5);
|
||||
f.translate(f.width()*0.5, f.height()*0.5);
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
Node *clip = AddTool::CreateAddableClip(command, s, Track::Reference(type, track_index), in, length, f);
|
||||
Node *clip = AddTool::CreateAddableClip(command, s, Track::Reference(type, track_index), in, length);
|
||||
|
||||
if (ShapeNodeBase *shape = dynamic_cast<ShapeNodeBase*>(clip)) {
|
||||
shape->SetRect(f, s->GetVideoParams(), command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
SetGizmos(clip);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user