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

Bug: Key signatures don't update with Stave Clef changes #727

Open
mix3d opened this issue Nov 10, 2019 · 5 comments
Open

Bug: Key signatures don't update with Stave Clef changes #727

mix3d opened this issue Nov 10, 2019 · 5 comments
Labels

Comments

@mix3d
Copy link
Contributor

mix3d commented Nov 10, 2019

I'm trying to make a simple selector for a user to set the Clef and Key, but I'm noticing I get the same results with both clefs, that the key isn't considering the set clef.

url: https://music-helper.netlify.com
code: https://github.com/mix3d/music-helper

I'm listening for changes in the dropdown, then calling setClef() or setKeySignature() on the staff, and then context.clear(); and stave.draw();

If I set the keySignature again after setting the clef, it draws correctly, so this is an order of operations issue (but no API docs sooo... #530 ). I would expect the Staff to update the keySignature correctly when it's Clef changes.

Example:
image
image

@mix3d
Copy link
Contributor Author

mix3d commented Nov 11, 2019

I've tried simulating what the Stave would do internally on clef change, (calling keySignatures[0].setKeySig), but this did not have the desired effect, even though calling stave.setKeySignature(keySelector.value) DID work.

// --- on clef change:
  stave.setClef(clefSelector.value);
  // because of issue #728, I have to do this manually
  const keySignatures = stave.getModifiers();
  keySignatures
    .filter(key => key.category === KeySignature.CATEGORY)
    .forEach(key => {
      key.setKeySig(keySelector.value)
      // also tried key.format() here
    })

I also tried editing the source setClef code, attempting to update the keysigs, but it does not seem to be working for me either.

    const keySignatures = this.getModifiers(position, KeySignature.CATEGORY);
    keySignatures.forEach(key => key.format())

@rvilarl
Copy link
Collaborator

rvilarl commented Jul 10, 2021

@mix3d is this still an issue or was it closed with the feature above?

@rvilarl
Copy link
Collaborator

rvilarl commented Jul 16, 2021

@0xfe do you know if this is still an issue?

@mix3d
Copy link
Contributor Author

mix3d commented Jul 16, 2021

@mix3d is this still an issue or was it closed with the feature above?

I'll try to get my project running this weekend and try again. I lost steam when the library wasn't as out-of-the-box as I'd hoped, and now that I'm taking a hiatus from my choir due to covid, I have even less pressure to make my project happen.

@rvilarl
Copy link
Collaborator

rvilarl commented Jul 16, 2021

@mix3d What is the name of your project?

@rvilarl rvilarl added the bug label Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants