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

Fix issues related to panning to a node #824

Merged
merged 2 commits into from
Dec 19, 2017

Conversation

chihuahua
Copy link
Member

@chihuahua chihuahua commented Dec 16, 2017

When a user selects a node that is out of view, the graph explorer pans
to it and centers it. Unfortunately, this feature had some issues.

  1. Panning happened before graph expansion completed. This led to pan
    target calculations that relied on incorrect, outdated measurements. We
    fix by waiting 250ms (the default duration for animations in the graph
    explorer) before panning in order to give enough time for node expansion
    to complete.

  2. The graph explorer did not take into account the position of the
    graph's root SVG element with respect to the viewport. This led to
    panning calculations that were off by a constant amount along the X and Y
    dimensions. We fix by taking those 2 values into account.

  3. Nodes could sometimes be occluded by the minimap - those nodes are
    strictly speaking still in the view of the graph explorer, so we
    previously did not pan to nodes occluded by the minimap. Now, we do.

Screenshot:

image

There are still issues related to panning that are not fixed. For
instance, we do not pan to extracted nodes.

Also, Panning sometimes yields a console error:

Error: <text> attribute x: Expected length, "NaN".

However, this PR does fix several big issues.

@chihuahua chihuahua requested a review from caisq December 16, 2017 04:17
@caisq caisq self-assigned this Dec 17, 2017
When a user selects a node that is out of view, the graph explorer pans
to it and centers it. Unfortunately, this feature had some issues.

0. Panning happened before graph expansion completed. This led to pan
target calculations that relied on incorrect, outdated measurements. We
fix by waiting 250ms (the default duration for animations in the graph
explorer) before panning in order to give enough time for node expansion
to complete.

1. The graph explorer did not take into account the position of the
graph's root SVG element with respect to the viewport. This led to
panning calculations that were slightly off. We fix by taking that into
account.

2. Nodes could sometimes be occluded by the minimap - those nodes are
strictly speaking still in the view of the graph explorer, so we
previously did not pan to nodes occluded by the minimap. Now, we do.

There are still issues related to panning that are not fixed. For
instance, we do not pan to extracted nodes. Panning sometimes yields a
console error:

```js
Error: <text> attribute x: Expected length, "NaN".
```

However, this PR does fix several big issues.
Copy link
Contributor

@caisq caisq 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 this, @chihuahua! This is definitely improvement from before. But I am still seeing some buggy behavior, probably what this PR isn't intended to fix. I think we can check this in first (after addressing the other comment) and tackle the remaining issues later.

isOutsideOfBounds(pointTL.y, pointBR.y, svgRect.height)) {

// Subtract to make sure that the node is not hidden behind the minimap.
const horizontalBound = svgRect.left + svgRect.width - 320;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to avoid these magic numbers?

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the numbers to constants.

Copy link
Member Author

@chihuahua chihuahua left a comment

Choose a reason for hiding this comment

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

Let me know what other issues you see! Indeed, lets resolve these issues first in this PR.

isOutsideOfBounds(pointTL.y, pointBR.y, svgRect.height)) {

// Subtract to make sure that the node is not hidden behind the minimap.
const horizontalBound = svgRect.left + svgRect.width - 320;
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved the numbers to constants.

@chihuahua
Copy link
Member Author

Yeah ... we currently do not pan to const nodes. They appear attached as annotations to other nodes, and there could be several of them. Like this:

image

That will be fixed in a separate PR.

@chihuahua chihuahua merged commit 8df235e into tensorflow:master Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants