-
-
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
Hide labels based off distance from camera #187
Changes from 3 commits
fcf60eb
56f7af5
6191694
b31e944
e38a8ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -296,6 +296,7 @@ export const GraphScene: FC<GraphSceneProps & { ref?: Ref<GraphSceneRef> }> = | |
const nodes = useStore(state => state.nodes); | ||
const edges = useStore(state => state.edges); | ||
const clusters = useStore(state => [...state.clusters.values()]); | ||
const isCentered = useStore(state => state.isCentered); | ||
|
||
// Center the graph on the nodes | ||
const { centerNodesById } = useCenterGraph({ | ||
|
@@ -429,11 +430,13 @@ export const GraphScene: FC<GraphSceneProps & { ref?: Ref<GraphSceneRef> }> = | |
); | ||
|
||
return ( | ||
<Fragment> | ||
{nodeComponents} | ||
{edgeComponents} | ||
{clusterComponents} | ||
</Fragment> | ||
isCentered && ( | ||
<Fragment> | ||
{nodeComponents} | ||
{edgeComponents} | ||
{clusterComponents} | ||
</Fragment> | ||
) | ||
Comment on lines
+432
to
+438
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could make more sense named
Without this the label visibility calculation is usually off on the initial render There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also gets rid of that laggy zoom out/jump on initial big graph renders which I think was previously being handled here with a |
||
); | ||
} | ||
); | ||
|
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.
You don't need to put this in the store based on the current useage, u could just return in state.