-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix(Intersection): bug causing selection edge case #8735
Conversation
Build Stats
|
4d34101
to
eef83a6
Compare
This reverts commit eef83a6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
const a2xa1x = a2.x - a1.x, | ||
a2ya1y = a2.y - a1.y, | ||
b2xb1x = b2.x - b1.x, | ||
b2yb1y = b2.y - b1.y, | ||
a1xb1x = a1.x - b1.x, | ||
a2ya1y = a2.y - a1.y, | ||
a2xa1x = a2.x - a1.x, | ||
a1yb1y = a1.y - b1.y, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed order to be less confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and found the algebra behind it and documented it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready after cleanup and JSDOC
I want to tweak logic a bit more |
I want to read this slowly because i want to understand what the bug is and how gets fixed since the code looks fine, but reading the Math require me to dedicate a bit of time to that. |
The entire impl was 💩, I don't know how it was uncovered for so long. I am guessing the selection PR surfaced it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it is ready for sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finally renamed and support infinite
to match the rest
Is not that i have any issues with a new implementation, but at this point i m curious to understand what in 5.x this was doing and what was its scope. |
Co-authored-by: Andrea Bogazzi <[email protected]>
same here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just the naming thing left, I don't mind to much
src/Intersection.ts
Outdated
* @param {Point} T the point we are checking for | ||
* @param {Point} A one extremity of the segment | ||
* @param {Point} B the other extremity of the segment | ||
* @param [extendToLine] if true checks if `T` is on the line defined by `A` and `B` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about thte name extendToLine
I chose infinite
same as the rest of the methods, but maybe that isn't great for non math users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took me a while to understand that infinite wasn't Math.inifinite, and i was telling myself, infinite is always true.
So i tried with a different name.
Was this infinite here before we restructured the class from 5.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see infinite i used in all the class and i think we should come up with a better name for it
considerSegmentAsLine, or something that. can be read and let not wonder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ll put back infinite for consistency, and then we can rename all together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this infinite here before we restructured the class from 5.x?
no, I put it I think to centralize logic
Motivation
I started experiencing a bug with selection
It collected objects if I clicked really fast on the canvas.
Description
The bug lies in
isContainedInInterval
I am to blame.
I wrote that assuming a state that apparently was incorrect.
Changes
Gist
In Action