Skip to content

Commit

Permalink
fix #93126: Dotted line to anchor when dragging element points off pa…
Browse files Browse the repository at this point in the history
…ge when in vertical orientation on page >1
  • Loading branch information
lasconic committed Jan 23, 2016
1 parent 94a0025 commit 8df88b7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
8 changes: 5 additions & 3 deletions libmscore/fret.cpp
Expand Up @@ -110,12 +110,14 @@ QLineF FretDiagram::dragAnchor() const
for (Element* e = parent(); e; e = e->parent())
xp += e->x();
qreal yp;
if (parent()->type() == Element::Type::SEGMENT)
yp = static_cast<Segment*>(parent())->measure()->system()->staffYpage(staffIdx());
if (parent()->type() == Element::Type::SEGMENT) {
System* system = static_cast<Segment*>(parent())->measure()->system();
yp = system->staffCanvasYpage(staffIdx());
}
else
yp = parent()->canvasPos().y();
QPointF p1(xp, yp);
return QLineF(p1, abbox().topLeft());
return QLineF(p1, canvasPos());
#if 0 // TODOxx
if (parent()->type() == Element::Type::SEGMENT) {
Segment* s = static_cast<Segment*>(parent());
Expand Down
2 changes: 1 addition & 1 deletion libmscore/line.cpp
Expand Up @@ -496,7 +496,7 @@ QLineF LineSegment::dragAnchor() const
return QLineF();
System* s;
QPointF p = line()->linePos(Grip::START, &s);
p += QPointF(s->canvasPos().x(), s->staffYpage(line()->staffIdx()));
p += QPointF(s->canvasPos().x(), s->staffCanvasYpage(line()->staffIdx()));

return QLineF(p, canvasPos());
}
Expand Down
2 changes: 1 addition & 1 deletion libmscore/symbol.cpp
Expand Up @@ -154,7 +154,7 @@ QLineF BSymbol::dragAnchor() const
{
if (parent() && parent()->type() == Element::Type::SEGMENT) {
System* system = segment()->measure()->system();
qreal y = system->staff(staffIdx())->y() + system->y();
qreal y = system->staffCanvasYpage(staffIdx());
// QPointF anchor(segment()->pageX(), y);
QPointF anchor(segment()->canvasPos().x(), y);
return QLineF(canvasPos(), anchor);
Expand Down
10 changes: 10 additions & 0 deletions libmscore/system.cpp
Expand Up @@ -1119,6 +1119,16 @@ qreal System::staffYpage(int staffIdx) const
return _staves[staffIdx]->y() + y(); // pagePos().y();
}

//---------------------------------------------------------
// staffCanvasYpage
// return canvas coordinates
//---------------------------------------------------------

qreal System::staffCanvasYpage(int staffIdx) const
{
return _staves[staffIdx]->y() + y() + page()->canvasPos().y();
}

//---------------------------------------------------------
// write
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libmscore/system.h
Expand Up @@ -128,6 +128,7 @@ class System : public Element {
QList<SysStaff*>* staves() { return &_staves; }
const QList<SysStaff*>* staves() const { return &_staves; }
qreal staffYpage(int staffIdx) const;
qreal staffCanvasYpage(int staffIdx) const;
#ifdef NDEBUG
SysStaff* staff(int staffIdx) const { return _staves[staffIdx]; }
#else
Expand Down
6 changes: 4 additions & 2 deletions libmscore/text.cpp
Expand Up @@ -2442,8 +2442,10 @@ QLineF Text::dragAnchor() const
for (Element* e = parent(); e; e = e->parent())
xp += e->x();
qreal yp;
if (parent()->type() == Element::Type::SEGMENT)
yp = static_cast<Segment*>(parent())->measure()->system()->staffYpage(staffIdx());
if (parent()->type() == Element::Type::SEGMENT) {
System* system = static_cast<Segment*>(parent())->measure()->system();
yp = system->staffCanvasYpage(staffIdx());
}
else
yp = parent()->canvasPos().y();
QPointF p1(xp, yp);
Expand Down

0 comments on commit 8df88b7

Please sign in to comment.