Skip to content

Commit

Permalink
fix #31086
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Aug 28, 2014
1 parent 54f4fc3 commit 95d04a4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libmscore/edit.cpp
Expand Up @@ -1730,7 +1730,7 @@ void Score::cmdDeleteSelection()
Fraction f;
int tick = -1;
Tuplet* tuplet = 0;
for (Segment* s = s1; s && (s != s2); s = s->next1()) {
for (Segment* s = s1; s && (s->tick() < stick2); s = s->next1()) {
if (s->element(track) && s->segmentType() == Segment::Type::Breath) {
deleteItem(s->element(track));
continue;
Expand Down
15 changes: 14 additions & 1 deletion mscore/scoreview.cpp
Expand Up @@ -3685,6 +3685,8 @@ void ScoreView::pageEnd()

void ScoreView::adjustCanvasPosition(const Element* el, bool playBack)
{
// printf("adjustCanvasPosition <%s>\n", el->name());

if (score()->layoutMode() == LayoutMode::LINE) {
qreal xo; // new x offset
qreal curPosR = _cursor->rect().right();
Expand Down Expand Up @@ -3729,14 +3731,19 @@ void ScoreView::adjustCanvasPosition(const Element* el, bool playBack)
else
return;

int staffIdx = el->staffIdx();
System* sys = m->system();
if (!sys)
return;

QPointF p(el->canvasPos());
QRectF r(imatrix.mapRect(geometry()));
QRectF mRect(m->canvasBoundingRect());
QRectF sysRect(sys->canvasBoundingRect());
QRectF sysRect;
if (staffIdx == -1)
sysRect = sys->canvasBoundingRect();
else
sysRect = sys->staff(staffIdx)->bbox();

// only try to track measure if not during playback
if (!playBack)
Expand All @@ -3747,6 +3754,12 @@ void ScoreView::adjustCanvasPosition(const Element* el, bool playBack)
QRectF showRect = QRectF(mRect.x(), sysRect.y(), mRect.width(), sysRect.height())
.adjusted(-border, -border, border, border);

/* printf("%f %f %f %f %f %f %f %f %d\n",
showRect.x(), showRect.y(), showRect.width(), showRect.height(),
r.x(), r.y(), r.width(), r.height(),
r.contains(showRect)
);
*/
// canvas is not as wide as measure, track note instead
if (r.width() < showRect.width()) {
showRect.setX(p.x());
Expand Down

0 comments on commit 95d04a4

Please sign in to comment.