Skip to content

Commit 11988fd

Browse files
committed
Account for continuous panel when adjusting canvas position to address #16173, #29928
1 parent 12ff0f8 commit 11988fd

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/notation/view/abstractnotationpaintview.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,14 @@ bool AbstractNotationPaintView::adjustCanvasPosition(const RectF& logicRect, boo
927927
TRACEFUNC;
928928

929929
RectF viewRect = viewport();
930+
PointF pos = viewRect.topLeft();
931+
932+
// Account for continuous panel if panning in continuous view
933+
qreal continuousPanelWidth = 0;
934+
if (notation()->viewMode() == engraving::LayoutMode::LINE) {
935+
continuousPanelWidth = m_continuousPanel->width();
936+
}
937+
viewRect.adjust(continuousPanelWidth, 0, 0, 0);
930938

931939
double viewArea = viewRect.width() * viewRect.height();
932940
double logicRectArea = logicRect.width() * logicRect.height();
@@ -948,17 +956,16 @@ bool AbstractNotationPaintView::adjustCanvasPosition(const RectF& logicRect, boo
948956
_scale = 1;
949957
}
950958

951-
PointF pos = viewRect.topLeft();
952959
PointF oldPos = pos;
953960

954961
RectF showRect = logicRect;
955962

956963
if (showRect.left() < viewRect.left()) {
957-
pos.setX(showRect.left() - border);
964+
pos.setX(showRect.left() - border - continuousPanelWidth);
958965
} else if (showRect.left() > viewRect.right()) {
959966
pos.setX(showRect.right() - width() / _scale + border);
960967
} else if (viewRect.width() >= showRect.width() && showRect.right() > viewRect.right()) {
961-
pos.setX(showRect.left() - border);
968+
pos.setX(showRect.left() - border - continuousPanelWidth);
962969
}
963970

964971
if (adjustVertically) {

src/notation/view/continuouspanel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ void ContinuousPanel::setNotation(INotationPtr notation)
5757
m_notation = notation;
5858
}
5959

60+
qreal ContinuousPanel::width() const
61+
{
62+
return m_width;
63+
}
64+
6065
//! NOTE: Copied from MU3
6166
void ContinuousPanel::paint(Painter& painter, const NotationViewContext& ctx, const engraving::rendering::PaintOptions& opt)
6267
{

src/notation/view/continuouspanel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ContinuousPanel : public muse::Injectable
5858
std::function<muse::PointF(const muse::PointF&)> fromLogical;
5959
};
6060

61+
qreal width() const;
6162
void paint(muse::draw::Painter& painter, const NotationViewContext& ctx, const engraving::rendering::PaintOptions& opt);
6263

6364
private:

0 commit comments

Comments
 (0)