Bug fixing in getting mouse position for issue #27.#68
Open
PhilJollans wants to merge 17 commits intomoonwave99:masterfrom
Open
Bug fixing in getting mouse position for issue #27.#68PhilJollans wants to merge 17 commits intomoonwave99:masterfrom
PhilJollans wants to merge 17 commits intomoonwave99:masterfrom
Conversation
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.
Do not apply the bottom border to `hoverDiv`. The bottom border was calculated once only, and is likely to be incorrect if the browser window is resized. However, this change means that the `hoverDiv` is larger than necessary. To counter this problem `getPositionFromMouseCoords` now has the return type `Position|undefined` and returns undefined if the mouse position is outside the fretboard by more than half the string separation. The calculation in `getPositionFromMouseCoords` has been simplified. It is now relative only to the stringsGroup and does not rely on the topPadding or LeftPadding.
|
I haven't used the fork related to this branch extensively, but there are definitely some bug fixes and nice additions 👍 |
…e nut. This differs from '0', which just shows an open string.
Extend the setDots() method to fill the `note` property, if it is not already filled.
…rcent Modify the function generateFrets to return pixel values. Modify the usage of the frets array to use the values directly, without appending a % character. Remove the scale transform from the 'fretboard-wrapper'
…d by the previous change, which moved away from defining the fret positions in percent.
…y are rendered on top of the fret marker dots. Handle in a similar manner to "dots".
Define a new method setMutedStrings, which can be called like setDots(). This makes it possible to mute strings without using the renderChord() method.
… into the `Options` structure: muteWidth: number; muteStrokeWidth: number; muteStrokeColor: string; Add additional options: degreeBackgroundColor: string; degreeStrokeColor: string; This allows flexibility for implementing dark and light modes (by specifying the colors using CSS variables). Render the marker dots under the frets and strings. From about fret 17, the marker dots are in fact too big. :(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second attempt to fix mouse events.
Do not apply the bottom border to
hoverDiv. The bottom border was calculated once only, and is likely to be incorrect if the browser window is resized. However, this change means that thehoverDivis larger than necessary.To counter this problem
getPositionFromMouseCoordsnow has the return typePosition|undefinedand returns undefined if the mouse position is outside the fretboard by more than half the string separation.The calculation in
getPositionFromMouseCoordshas been simplified. It is now relative only to the stringsGroup and does not rely on the topPadding or LeftPadding.