Add ability to focus on a node to tree

Summary: Added context menu to tree nodes that 'focuses' a node. This will make the node the root of the tree. Focus state can be removed again via context menu but we could add a permanent button in the future

Reviewed By: lblasa

Differential Revision: D41493002

fbshipit-source-id: 43ec7a25aeea0b169cbcbb1ac20ac22ea893fee2
This commit is contained in:
Luke De Feo
2022-11-24 09:23:16 -08:00
committed by Facebook GitHub Bot
parent 01f7fa34e5
commit 4b566dbe03
2 changed files with 99 additions and 33 deletions

View File

@@ -48,6 +48,8 @@ export function plugin(client: PluginClient<Events>) {
perfEvents.append(event);
});
const focusedNode = createState<Id | undefined>(undefined);
const nodes = createState<Map<Id, UINode>>(new Map());
const snapshot = createState<{nodeId: Id; base64Image: Snapshot} | null>(
null,
@@ -108,6 +110,7 @@ export function plugin(client: PluginClient<Events>) {
rootId,
nodes,
metadata,
focusedNode,
snapshot,
hoveredNodes,
perfEvents,