-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fretboard OnClick, clickable area slighty off from note position #27
Comments
Hey Diago I know your a busy guy right now, but any chance you might have a chance to look at this bug? |
I have it a look under xmas and looks trickier than expected (due to svg scaling / padding). Atm I have definitely 0% time unfortunately. Hope to find some in the next weeks! |
I have made two changes: - pass topPadding into the function and subtract it from the Y position - compare the Y coordinate to 0.5, 1.5, ... times the string separation Previously, the Y coordinate was compared to 1, 2, ... times the separation. I think this only worked, when topPadding was approximately half of the string separation.
I have created a pull request (#67) which I think will fix this problem. The strings group is offset vertically from At the same time, the Y coordinate is compared to 1 * This previously worked more or less correctly if topPadding was approximately half the string separation, in which case the two effect cancelled each other out. If you change the Sorry, I might have been a bit too quick with my pull request. There still appears to be a problem, in particular if you set the height to a low value, like 75 or even 50. |
I have closed my first pull request, but now made a second pull request (#68) with a new fix to the problem. The size of the hoverDiv was unreliable, in particular if you started resizing the window. This could change the size of the SVG diagram, but it did not modify the bottom margin. I have simply dumped the bottom margin, setting it to zero. This however means the hoverDiv is typically too big and can generate events away from the fretboard (in the fret numbers). To counter that I have changed the return type of Determining the position was actually more complicated than necessary. In particular, it now only fetches the strings group, and calculates the position relative to its top left corner. |
If you click on the bottom part of a note on String 6, it returns that note from string 1
View console for output.
https://codepen.io/aduffy/pen/dypvjKa?editors=0001
The text was updated successfully, but these errors were encountered: