diff --git a/src/gui/editors/notation/NotationScene.cpp b/src/gui/editors/notation/NotationScene.cpp index 8181e0b33..168d490a3 100644 --- a/src/gui/editors/notation/NotationScene.cpp +++ b/src/gui/editors/notation/NotationScene.cpp @@ -1175,12 +1175,20 @@ NotationScene::getCursorCoordinates(timeT t) const CursorCoordinates cc; cc.allStaffs = QLineF(top.first, top.second, bottom.first, bottom.second); - //cc.currentStaff = QLineF(singleTop.first, singleTop.second, - // singleBottom.first, singleBottom.second); - //cc.currentStaff = QLineF(top.first, top.second, - // bottom.first, bottom.second); + + // if the time is within the current segment we take the + // singleTop/Bottom cursor for time accuracy within that + // segment. If the time is outside the current segment we just use + // the top/bottom x coordinate to avoid the cursor jumping to the + // current segment. cc.currentStaff = QLineF(top.first, singleTop.second, bottom.first, singleBottom.second); + if (currentStaff && currentStaff->includesTime(t)) { + // take the cursor position caluclated from the layout + cc.currentStaff = QLineF(singleTop.first, singleTop.second, + singleBottom.first, singleBottom.second); + } + return cc; } diff --git a/src/gui/editors/notation/NotationStaff.cpp b/src/gui/editors/notation/NotationStaff.cpp index dd1f8f83f..8ab97efc4 100644 --- a/src/gui/editors/notation/NotationStaff.cpp +++ b/src/gui/editors/notation/NotationStaff.cpp @@ -1979,7 +1979,7 @@ NotationStaff::makeViewElement(Rosegarden::Event* e) } bool -NotationStaff::includesTime(timeT t) +NotationStaff::includesTime(timeT t) const { Composition *composition = getSegment().getComposition(); diff --git a/src/gui/editors/notation/NotationStaff.h b/src/gui/editors/notation/NotationStaff.h index 2c456dc41..045b98965 100644 --- a/src/gui/editors/notation/NotationStaff.h +++ b/src/gui/editors/notation/NotationStaff.h @@ -260,7 +260,7 @@ class NotationStaff : public QObject, // Just for tr(). Could be cleaned up. */ timeT getTimeAtSceneCoords(double cx, int cy) const; - bool includesTime(timeT t); + bool includesTime(timeT t) const; timeT getStartTime() const;