-
-
Notifications
You must be signed in to change notification settings - Fork 67
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 2d graph over-rotating on node select #198
Conversation
/** | ||
* Get the closest axis to a given angle. | ||
*/ | ||
export function getClosestAxis(angle: number, axes: number[]) { |
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.
Quick unit test please.
/** | ||
* Get how far an angle is from the closest 2D axis in radians. | ||
*/ | ||
export function getDegreesToClosest2dAxis( |
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.
Quick unit test please.
@@ -71,7 +71,13 @@ export const useCenterGraph = ({ | |||
|
|||
// Check whether the layout is 3d or not to adjust centering logic | |||
if (!layoutType.includes('3d')) { | |||
void controls?.rotateTo(0, Math.PI / 2, true); | |||
const { horizontalRotation, verticalRotation } = |
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.
Let's add a description on what this is/why
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
2d graphs over-rotate sometimes when selecting or de-selecting a node
Issue Number: #192
What is the new behavior?
2d graphs will rotate to the closest flat axis on node selection
Does this PR introduce a breaking change?
Other information
BEFORE
Screen.Recording.2024-03-05.at.2.54.53.PM.mov
AFTER
Screen.Recording.2024-03-05.at.2.58.08.PM.mov