Skip to content
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

Bugs with focusNodeId #341

Conversation

veredwpsemantix
Copy link

@veredwpsemantix veredwpsemantix commented Jun 28, 2020

This PR includes fixing those bugs:

  1. If we move the graph to a new position while it's focused on a specific node, the graph will jump to an unwanted place.
    https://share.vidyard.com/watch/cEnBeTdYgZeYRnp4PxMMvL?
  2. If we move the graph to a new position while it's focused on a specific node, and we will focus on the same node again, the graph will not change its position.
    https://share.vidyard.com/watch/mzsVrDypdxVMsfosq5kV6x?

wpvered added 4 commits June 28, 2020 15:50
1. When the user is passing hight/width props, the graph size isn't set to those parameters.
2. If we move the graph to a new position while it's focused on a specific node,  the graph will jump to an unwanted place.
3. If we move the graph to a new position while it's focused on a specific node,  and we will focus on the same node again, the graph will not change its position.
Once the user passed FocusNodeId to the graph, and he moved the graph to a new position, if componentWillReciveProps will call again the graph will always return to the location of the Focus Node.
On the other hand, if the user cancels the focus node and passes an undefined parameter to the graph, the graph will return to the initial position and will be a jump in the position when we will render again the Graph component.
We want the graph to always keep its last position - when there is a focus node and when there is no, and when we will render the component again (componentWillReciveProps), the graph will not change its position unless we passed focus node id.
Copy link
Owner

@danielcaldas danielcaldas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I'll just request that you address the comments I left and additionally please fix the lint issues pointed in the CI failures. To check for lint errors locally use npm run lint.

I'll have another look and test once the comments are addressed. Thanks once more for you contribution.

@@ -32,6 +32,9 @@ import ERRORS from "../../err";

import { isDeepEqual, isEmptyObject, merge, pick, antiPick, throwErr, logWarning } from "../../utils";
import { computeNodeDegree } from "./collapse.helper";
import { select as d3Select } from "d3-selection";
import * as d3 from "d3";
import { zoom as d3Zoom } from "d3-zoom";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { zoom as d3Zoom } from "d3-zoom";
import { zoom as d3Zoom, zoomIdentity as d3ZoomIdentity } from "d3-zoom";

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import from d3-zoom instead.

@@ -32,6 +32,9 @@ import ERRORS from "../../err";

import { isDeepEqual, isEmptyObject, merge, pick, antiPick, throwErr, logWarning } from "../../utils";
import { computeNodeDegree } from "./collapse.helper";
import { select as d3Select } from "d3-selection";
import * as d3 from "d3";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import * as d3 from "d3";


const selector = d3Select(`#${containerElId}`);
// in order to initilize the new position
selector.call(d3Zoom().transform, d3.zoomIdentity.translate(transform.x, transform.y).scale(transform.k));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need to verify that focusAnimationDuration doesn't break with this change. @LonelyPrincess if you have some time could you please have a look at this one? I remember you implemented this one initially. Thanks!

src/components/graph/Graph.jsx Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Sep 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@danielcaldas
Copy link
Owner

@veredwpsemantix feel free to bring this PR back to life 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants