Skip to content

Commit

Permalink
Fix closest staff finding and pitch alignment for new inserted element
Browse files Browse the repository at this point in the history
- Revert changes in `ClosestBB::distanceToBB()`
- Call `Page::LayOutPitchPos()` after adjust pitch

Refs: DDMAL/Neon#1226
  • Loading branch information
yinanazhou committed Jun 26, 2024
1 parent 71e2b67 commit f26ab8c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/vrv/editortoolkit_neume.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ struct ClosestBB {
int offset = (x - ulx) * tan(rotate * M_PI / 180.0);
uly = uly + offset;
lry = lry + offset;
int xDiff = std::abs(x - ulx);
int yDiff = std::abs(y - uly);
int xDiff = std::max((ulx > x ? ulx - x : 0), (x > lrx ? x - lrx : 0));
int yDiff = std::max((uly > y ? uly - y : 0), (y > lry ? y - lry : 0));

return sqrt(xDiff * xDiff + yDiff * yDiff);
}
Expand Down
1 change: 1 addition & 0 deletions src/editortoolkit_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,7 @@ bool EditorToolkitNeume::Insert(std::string elementType, std::string staffId, in
}
layer->ReorderByXPos();

m_doc->GetDrawingPage()->LayOutPitchPos();
if (m_doc->IsTranscription() && m_doc->HasFacsimile()) m_doc->SyncFromFacsimileDoc();

m_editInfo.import("status", status);
Expand Down

0 comments on commit f26ab8c

Please sign in to comment.