Skip to content

Commit 1889893

Browse files
Merge pull request #18511 from mike-spa/port#18510
Port #18510
2 parents af43a82 + 4648c6f commit 1889893

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/engraving/libmscore/chordline.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,11 @@ std::vector<PointF> ChordLine::gripsPositions(const EditData&) const
198198
return {};
199199
}
200200

201-
double sp = spatium();
202201
auto n = m_path.elementCount();
203202
PointF cp(pagePos());
204203
if (m_straight) {
205204
// limit the number of grips to one
206-
double offset = 0.5 * sp;
205+
double offset = 0.5;
207206
PointF p;
208207

209208
if (m_chordLineType == ChordLineType::FALL) {
@@ -217,7 +216,7 @@ std::vector<PointF> ChordLine::gripsPositions(const EditData&) const
217216
}
218217

219218
// translate on the length and height - stops the grips from going past boundaries of slide
220-
p += (cp + PointF(m_path.elementAt(1).x * sp, m_path.elementAt(1).y * sp));
219+
p += (cp + PointF(m_path.elementAt(1).x, m_path.elementAt(1).y));
221220
return { p };
222221
} else {
223222
std::vector<PointF> grips(n);

src/engraving/rw/read400/tread.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,6 +2541,9 @@ void TRead::read(ChordLine* l, XmlReader& e, ReadContext& ctx)
25412541
int type = e.intAttribute("type");
25422542
double x = e.doubleAttribute("x");
25432543
double y = e.doubleAttribute("y");
2544+
double spatium = ctx.spatium();
2545+
x *= spatium;
2546+
y *= spatium;
25442547
switch (PainterPath::ElementType(type)) {
25452548
case PainterPath::ElementType::MoveToElement:
25462549
path.moveTo(x, y);

src/engraving/rw/read410/tread.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,6 +2530,9 @@ void TRead::read(ChordLine* l, XmlReader& e, ReadContext& ctx)
25302530
int type = e.intAttribute("type");
25312531
double x = e.doubleAttribute("x");
25322532
double y = e.doubleAttribute("y");
2533+
double spatium = ctx.spatium();
2534+
x *= spatium;
2535+
y *= spatium;
25332536
switch (PainterPath::ElementType(type)) {
25342537
case PainterPath::ElementType::MoveToElement:
25352538
path.moveTo(x, y);

src/engraving/rw/write/twrite.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,10 @@ void TWrite::write(const ChordLine* item, XmlWriter& xml, WriteContext& ctx)
857857
xml.startElement("Path");
858858
for (size_t i = 0; i < n; ++i) {
859859
const PainterPath::Element& e = path.elementAt(i);
860-
xml.tag("Element", { { "type", int(e.type) }, { "x", e.x }, { "y", e.y } });
860+
double spatium = item->spatium();
861+
double x = e.x / spatium;
862+
double y = e.y / spatium;
863+
xml.tag("Element", { { "type", int(e.type) }, { "x", x }, { "y", y } });
861864
}
862865
xml.endElement();
863866
}

0 commit comments

Comments
 (0)