-
Notifications
You must be signed in to change notification settings - Fork 662
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,6 +337,9 @@ export class Stave extends Element { | |
clefs[0].setType(clefSpec, size, annotation); | ||
} | ||
|
||
const keySignatures = this.getModifiers(position, KeySignature.CATEGORY); | ||
keySignatures.forEach(key => key.format()) | ||
|
||
return this; | ||
} | ||
|
||
|
@@ -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()) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()) | ||
); | ||
} | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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