Skip to content

Commit

Permalink
Merge pull request #3979 from jthistle/276392-implement-foto-mode-shi…
Browse files Browse the repository at this point in the history
…ft-drag

fix #276392: shift+click to select in foto mode doesn't work
  • Loading branch information
anatoly-os committed Oct 4, 2018
2 parents 470e591 + 1990054 commit a9415fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions mscore/events.cpp
Expand Up @@ -260,7 +260,9 @@ void ScoreView::mouseReleaseEvent(QMouseEvent*)
case ViewState::PLAY:
case ViewState::ENTRY_PLAY:
case ViewState::FOTO:
break;
case ViewState::FOTO_LASSO:
changeState(ViewState::FOTO);
break;
}
}
Expand Down Expand Up @@ -379,10 +381,13 @@ void ScoreView::mousePressEvent(QMouseEvent* ev)
break;
}
}

if (gripClicked)
changeState(ViewState::FOTO_DRAG_EDIT);
else if (_foto->canvasBoundingRect().contains(editData.startMove))
changeState(ViewState::FOTO_DRAG_OBJECT);
else if (ev->modifiers() & Qt::ShiftModifier)
changeState(ViewState::FOTO_LASSO);
else
changeState(ViewState::FOTO_DRAG);
}
Expand Down Expand Up @@ -513,6 +518,10 @@ void ScoreView::mouseMoveEvent(QMouseEvent* me)
dragScoreView(me);
break;

case ViewState::FOTO_LASSO:
doDragFoto(me);
break;

default:
break;
}
Expand Down Expand Up @@ -825,6 +834,9 @@ void ScoreView::changeState(ViewState s)
case ViewState::LASSO:
endLasso();
break;
case ViewState::FOTO_LASSO:
endFotoDrag();
break;
case ViewState::PLAY:
seq->stop();
break;
Expand Down Expand Up @@ -878,7 +890,9 @@ void ScoreView::changeState(ViewState s)
seq->start();
break;
case ViewState::ENTRY_PLAY:
break;
case ViewState::FOTO_LASSO:
startFotoDrag();
break;
}

Expand Down
6 changes: 5 additions & 1 deletion mscore/fotomode.cpp
Expand Up @@ -135,9 +135,13 @@ void ScoreView::startFotoDrag()

void ScoreView::doDragFoto(QMouseEvent* ev)
{
_foto->setUserOff(QPointF(0.0, 0.0));
QPointF p = toLogical(ev->pos());
QPointF sm = editData.startMove;

QRectF r;
r.setCoords(editData.startMove.x(), editData.startMove.y(), p.x(), p.y());
r.setCoords(sm.x(), sm.y(), p.x(), p.y());

_foto->setbbox(r.normalized());

QRectF rr(_foto->bbox());
Expand Down

0 comments on commit a9415fd

Please sign in to comment.