Bug: Render fails with error if fretboard to small for all notes in box.
Closed this issue · 5 comments
If the notes in a box extend past "fretCount" then the render fails with error
"Uncaught TypeError: can't access property "x", positions[(string - 1)][(fret - dotOffset)] is undefined"
https://codepen.io/aduffy/pen/PoGpGvE
Expected behavior : Should just draw what it can and ignore notes that do not fit.
Im building a "merged" set of boxes for Major scale and want to include up to 24th fret in those. But in practice would typical want to render at a more realistic 5 fret view..
The graceful draw behaviour is reasonable, I will address it.
What do you mean by "a more realistic 5 fret view"? Could you sketch it please?
I don't know if it may be of any help, there is the crop
option that can show just the needed fretboard portion, i.e.:
const fretboard = new Fretboard({
crop: true,
fretCount: 5
});
fretboard.render(a box that spans 5 frets)
The rendered fretboard will have just 5 frets, numbered starting from the lowest note position of the box (e.g. a Am pentatonic / 1st box will start at fret 5).
Sorry that was just a typo.. I meant to type 15 fret view.. (Im mostly on an acoustic when working theory, but i guess my electric does go to 22! ) But regardless, I didnt know about that crop feature... could be very usefull.
Aaaah I see! Btw I drafted the full fretboard scale feature, as soon as I have a moment I'll refine it and comment on the PR so you can give me some suggestions, thanks a lot for all the feedback!
Cool. I really hope im not being a pain in the ass with all my "issues" :-) This is a great tool and I see a lot of different ways I can use in a website Im workign on! Not to mention, im learning a lot both about music theory and JS by snooping around your code!
Thank you so much for the kind words ^^ btw this should be ok in v0.2!