Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix closest staff finding and pitch alignment for new inserted element #147

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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