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

Feature: Allow getting all staff modifiers by category, without position #728

Merged
merged 2 commits into from
Nov 27, 2019
Merged
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions src/stave.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ export class Stave extends Element {
clefs[0].setType(clefSpec, size, annotation);
}

const keySignatures = this.getModifiers(position, KeySignature.CATEGORY);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines look unrelated to the PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this was my attempt to fix #727. Will remove

keySignatures.forEach(key => key.format())

return this;
}

Expand Down Expand Up @@ -427,10 +430,10 @@ export class Stave extends Element {
}

getModifiers(position, category) {
if (position === undefined) return this.modifiers;
if (position === undefined && category === undefined) return this.modifiers;

return this.modifiers.filter(modifier =>
position === modifier.getPosition() &&
(position === undefined || position === modifier.getPosition()) &&
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks safe, but I'm hesitant to accept without making sure that there were no diffs in the visual regression tests. Can you confirm please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xfe Any suggestions on how I can confirm these tests pass? Having issues getting setup to run locally.

(category === undefined || category === modifier.getCategory())
);
}
Expand Down