Speed up distanceBetweenTwoPoints, and standardize getGestureProgess usage #54
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.
I decided to develop my own fork in its own direction as a way to gain some JavaScript experience, but I want to keep contributing to this project, so I'm going to maintain a 'mergeback' branch where I'll put updates and fixes that I think could help the project out. I'll make sure to avoid pushing more updates to the branch until any previous PR I've opened from it has been closed.
Here's a couple fixes that I think could be useful:
Math.hypot()
in util.js insidedistanceBetweenTwoPoints()
. It's what this function is doing anyway, and this internally defined function should be able to solve the problem faster and more reliably. I also got rid of theMath.round()
line, because I don't see any benefit to using computational resources to truncate the precision of the function like that. If someone wants only two decimal places in their output they can useNumber.prototype.toFixed()
.getGestureProgress()
is called. Most gestures were passing inthis.getId()
but a couple were passing inthis.type
. It seems to me that they should be consistent.