Skip to content

Commit 13331fe

Browse files
committed
Add arrangement drop area extension point
1 parent e41ad55 commit 13331fe

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎src/plugins/visualeditor/internal/addon/ArrangementAddOn.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ namespace VisualEditor::Internal {
8484
return qobject_cast<QQmlComponent *>(Core::RuntimeInterface::instance()->getFirstObject("org.diffscope.visualeditor.audiothumbnailcomponent"));
8585
}
8686

87+
QQmlComponent *ArrangementAddOn::dropAreaComponent() {
88+
return qobject_cast<QQmlComponent *>(Core::RuntimeInterface::instance()->getFirstObject("org.diffscope.visualeditor.arrangementdropareacomponent"));
89+
}
90+
8791
bool ArrangementAddOn::eventFilter(QObject *watched, QEvent *event) {
8892
if (watched == windowHandle()->window()) {
8993
switch (event->type()) {

‎src/plugins/visualeditor/internal/addon/ArrangementAddOn.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace VisualEditor::Internal {
2424
Q_PROPERTY(AdditionalTrackLoader *additionalTrackLoader READ additionalTrackLoader CONSTANT)
2525
Q_PROPERTY(bool altPressed READ altPressed NOTIFY altPressedChanged)
2626
Q_PROPERTY(QQmlComponent *audioThumbnailComponent READ audioThumbnailComponent CONSTANT)
27+
Q_PROPERTY(QQmlComponent *dropAreaComponent READ dropAreaComponent CONSTANT)
2728
public:
2829
explicit ArrangementAddOn(QObject *parent = nullptr);
2930
~ArrangementAddOn() override;
@@ -43,6 +44,7 @@ namespace VisualEditor::Internal {
4344
bool altPressed() const;
4445

4546
static QQmlComponent *audioThumbnailComponent();
47+
static QQmlComponent *dropAreaComponent();
4648

4749
Q_SIGNALS:
4850
void altPressedChanged();

‎src/plugins/visualeditor/qml/ArrangementView.qml‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,18 @@ Item {
242242
id: clipViewContainer
243243
Layout.fillWidth: true
244244
Layout.fillHeight: true
245+
// Drop components set cursorPositionActive while controlling the time cursor.
246+
property Item dropArea: null
247+
248+
Component.onCompleted: {
249+
const component = view.addOn?.dropAreaComponent
250+
if (component) {
251+
dropArea = component.createObject(clipViewContainer, {
252+
"contextObject": view.arrangementPanelInterface
253+
})
254+
}
255+
}
256+
245257
ClipPane {
246258
id: clipPane
247259
anchors.fill: parent
@@ -381,15 +393,17 @@ Item {
381393
timeLayoutViewModel: view.arrangementPanelInterface?.timeLayoutViewModel ?? null
382394
}
383395
onHoveredChanged: () => {
384-
if (!hovered) {
396+
if (!hovered && !clipViewContainer.dropArea?.cursorPositionActive) {
385397
view.arrangementPanelInterface.timeLayoutViewModel.cursorPosition = -1
386398
}
387399
}
388400
onPointChanged: () => {
401+
if (clipViewContainer.dropArea?.cursorPositionActive)
402+
return
389403
view.arrangementPanelInterface.timeLayoutViewModel.cursorPosition = timeManipulator.alignPosition(timeManipulator.mapToPosition(point.position.x), ScopicFlow.AO_Visible)
390404
}
391405
onEnabledChanged: {
392-
if (!enabled) {
406+
if (!enabled && !clipViewContainer.dropArea?.cursorPositionActive) {
393407
view.arrangementPanelInterface.timeLayoutViewModel.cursorPosition = -1
394408
}
395409
}

0 commit comments

Comments
 (0)