Skip to content

Commit

Permalink
fix #41596: initial position of continuous view for first measure
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Dec 20, 2014
1 parent 1f5915e commit 768b9f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions mscore/musescore.cpp
Expand Up @@ -82,7 +82,7 @@

#include "libmscore/mscore.h"
#include "libmscore/system.h"
#include "libmscore/measurebase.h"
#include "libmscore/measure.h"
#include "libmscore/chordlist.h"
#include "libmscore/volta.h"
#include "libmscore/lasso.h"
Expand Down Expand Up @@ -4275,9 +4275,9 @@ void MuseScore::switchLayoutMode(int val)
LayoutMode mode;
// find a measure to use as reference, if possible
QRectF view = cv->toLogical(QRect(0.0, 0.0, width(), height()));
MeasureBase* m = cs->measures()->first();
Measure* m = cs->firstMeasure();
while (m && !view.intersects(m->canvasBoundingRect()))
m = m->nextMM();
m = m->nextMeasureMM();
if (val == 0)
mode = LayoutMode::PAGE;
else
Expand All @@ -4290,7 +4290,7 @@ void MuseScore::switchLayoutMode(int val)
// also, better positioning is usually achieved if you start from the top
// and there is really no better place to position canvas if we were all the way off page previously
cv->pageTop();
if (m)
if (m && m != cs->firstMeasure())
cv->adjustCanvasPosition(m, false);
endCmd();
}
Expand Down
10 changes: 5 additions & 5 deletions mscore/scoreview.cpp
Expand Up @@ -3627,8 +3627,8 @@ void ScoreView::pagePrev()
return;
if (score()->layoutMode() == LayoutMode::LINE) {
qreal x = xoffset() + width() * .8;
if (x > 0.0)
x = 0;
if (x > 10.0)
x = 10.0;
setOffset(x, yoffset());
}
else {
Expand All @@ -3648,7 +3648,7 @@ void ScoreView::pagePrev()
void ScoreView::pageTop()
{
if (score()->layoutMode() == LayoutMode::LINE)
setOffset(0.0, 0.0);
setOffset(10.0, 0.0);
else
setOffset(10.0, 10.0);
update();
Expand Down Expand Up @@ -3727,8 +3727,8 @@ void ScoreView::adjustCanvasPosition(const Element* el, bool playBack)
xo = -curPosR * mag() + width() - marginRight;

// Bring back the score to the left to avoid blank gap on the left.
if (xo > 0)
xo = 0;
if (xo > 10)
xo = 10;

setOffset(xo, yoffset());
update();
Expand Down

0 comments on commit 768b9f9

Please sign in to comment.