Skip to content

Commit f00043e

Browse files
committed
23033: Parts are displayed at incorrect zoom level when the Navigator is open
1 parent 2d9d1b0 commit f00043e

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

src/notation/view/abstractnotationpaintview.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ void AbstractNotationPaintView::onCurrentNotationChanged()
229229
void AbstractNotationPaintView::onLoadNotation(INotationPtr)
230230
{
231231
if (viewport().isValid() && !m_notation->viewState()->isMatrixInited()) {
232-
m_inputController->initZoom();
233-
m_inputController->initCanvasPos();
232+
initZoomAndPosition();
234233
}
235234

236235
if (publishMode()) {
@@ -332,6 +331,10 @@ void AbstractNotationPaintView::onUnloadNotation(INotationPtr)
332331
}
333332
}
334333

334+
void AbstractNotationPaintView::initZoomAndPosition()
335+
{
336+
}
337+
335338
void AbstractNotationPaintView::setMatrix(const Transform& matrix)
336339
{
337340
if (m_matrix == matrix) {
@@ -380,8 +383,7 @@ void AbstractNotationPaintView::onViewSizeChanged()
380383

381384
if (viewport().isValid()) {
382385
if (!notation()->viewState()->isMatrixInited()) {
383-
m_inputController->initZoom();
384-
m_inputController->initCanvasPos();
386+
initZoomAndPosition();
385387
} else {
386388
m_inputController->updateZoomAfterSizeChange();
387389
}
@@ -413,6 +415,11 @@ void AbstractNotationPaintView::updateLoopMarkers()
413415
scheduleRedraw();
414416
}
415417

418+
NotationViewInputController* AbstractNotationPaintView::inputController() const
419+
{
420+
return m_inputController.get();
421+
}
422+
416423
INotationPtr AbstractNotationPaintView::notation() const
417424
{
418425
return m_notation;

src/notation/view/abstractnotationpaintview.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ class AbstractNotationPaintView : public muse::uicomponents::QuickPaintedView, p
167167
protected:
168168
INotationPtr notation() const;
169169
void setNotation(INotationPtr notation);
170+
171+
NotationViewInputController* inputController() const;
172+
170173
void setReadonly(bool readonly);
171174
void setMatrix(const muse::draw::Transform& matrix);
172175

@@ -183,6 +186,8 @@ class AbstractNotationPaintView : public muse::uicomponents::QuickPaintedView, p
183186
virtual void onLoadNotation(INotationPtr notation);
184187
virtual void onUnloadNotation(INotationPtr notation);
185188

189+
virtual void initZoomAndPosition();
190+
186191
virtual void onMatrixChanged(const muse::draw::Transform& oldMatrix, const muse::draw::Transform& newMatrix, bool overrideZoomType);
187192

188193
protected slots:

src/notation/view/notationpaintview.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ void NotationPaintView::onUnloadNotation(INotationPtr notation)
5454
notation->viewState()->matrixChanged().resetOnReceive(this);
5555
}
5656

57+
void NotationPaintView::initZoomAndPosition()
58+
{
59+
if (notation() && !notation()->viewState()->isMatrixInited()) {
60+
inputController()->initZoom();
61+
inputController()->initCanvasPos();
62+
}
63+
}
64+
5765
void NotationPaintView::onMatrixChanged(const Transform& oldMatrix, const Transform& newMatrix, bool overrideZoomType)
5866
{
5967
AbstractNotationPaintView::onMatrixChanged(oldMatrix, newMatrix, overrideZoomType);

src/notation/view/notationpaintview.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class NotationPaintView : public AbstractNotationPaintView
3434
void onLoadNotation(INotationPtr notation) override;
3535
void onUnloadNotation(INotationPtr notation) override;
3636

37+
void initZoomAndPosition() override;
38+
3739
void onMatrixChanged(const muse::draw::Transform& oldMatrix, const muse::draw::Transform& newMatrix,
3840
bool overrideZoomType = true) override;
3941

0 commit comments

Comments
 (0)