diff --git a/src/plugins/score-plugin-scenario/Scenario/Document/Interval/FullView/NodalIntervalView.cpp b/src/plugins/score-plugin-scenario/Scenario/Document/Interval/FullView/NodalIntervalView.cpp index 2253d06f8e..79a1b38255 100644 --- a/src/plugins/score-plugin-scenario/Scenario/Document/Interval/FullView/NodalIntervalView.cpp +++ b/src/plugins/score-plugin-scenario/Scenario/Document/Interval/FullView/NodalIntervalView.cpp @@ -103,9 +103,6 @@ void NodalIntervalView::recenterRelativeToView() auto viewRect = QRectF{viewTopLeft, viewBottomRight}; auto visibleRect = viewRect.intersected(parentRect); - // qDebug() << "\n- parent:" << parentRect << "\n- child:" << childRect - // << "\n- view:" << viewRect << "\n- visible:" << visibleRect; - auto childCenter = m_container->mapRectToParent(childRect).center() - m_container->pos(); auto ourCenter = visibleRect.center(); @@ -135,6 +132,7 @@ void NodalIntervalView::recenter() void NodalIntervalView::rescale() { + recenterRelativeToView(); auto parentRect = boundingRect(); auto childRect = enclosingRect(); @@ -273,6 +271,9 @@ void NodalIntervalView::mousePressEvent(QGraphicsSceneMouseEvent* e) m_pressedPos = e->scenePos(); e->accept(); + + score::SelectionDispatcher disp{m_context.selectionStack}; + disp.select(m_model); } void NodalIntervalView::mouseMoveEvent(QGraphicsSceneMouseEvent* e) diff --git a/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioDocument/CentralNodalDisplay.cpp b/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioDocument/CentralNodalDisplay.cpp index 70af147079..6f5d8cf191 100644 --- a/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioDocument/CentralNodalDisplay.cpp +++ b/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioDocument/CentralNodalDisplay.cpp @@ -48,7 +48,7 @@ void CentralNodalDisplay::init() this->recenter(); }); - QTimer::singleShot(0, presenter, &NodalIntervalView::recenter); + QTimer::singleShot(0, presenter, &NodalIntervalView::recenterRelativeToView); } void CentralNodalDisplay::recenter() diff --git a/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioEditor.cpp b/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioEditor.cpp index a840f97518..ee3e0e3ac7 100644 --- a/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioEditor.cpp +++ b/src/plugins/score-plugin-scenario/Scenario/Document/ScenarioEditor.cpp @@ -272,8 +272,7 @@ bool ScenarioEditor::paste( } else { - // FIXME proper nodal position - return pasteInInterval(*obj, QPointF{0., 0.}, mime, ctx); + return pasteInInterval(*obj, newProcessPosition(*obj), mime, ctx); } } else if(auto obj = qobject_cast(sel.at(0))) @@ -283,13 +282,15 @@ bool ScenarioEditor::paste( else if(auto obj = qobject_cast(sel.at(0))) { // Do nothing, handled below as we really need the position in the view + // FIXME if we're in nodal view and pasting just a process and + // not clicking in the scenario then it would be better to paste + // next to the scenario } else if(auto obj = qobject_cast(sel.at(0))) { if(auto itv = Scenario::closestParentInterval(obj)) { - // FIXME proper nodal position - return pasteInInterval(*itv, QPointF{0., 0.}, mime, ctx); + return pasteInInterval(*itv, newProcessPosition(*itv), mime, ctx); } } }