From 7303c0c91fd34473c7e48d3c46d807e11c156a23 Mon Sep 17 00:00:00 2001 From: Google AI Edge Date: Mon, 7 Oct 2024 09:52:22 -0700 Subject: [PATCH] Don't try to sync-navigate to a node that is hidden in layout. PiperOrigin-RevId: 683220206 --- src/ui/src/components/visualizer/sync_navigation_button.ts | 3 +-- src/ui/src/components/visualizer/webgl_renderer.ts | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ui/src/components/visualizer/sync_navigation_button.ts b/src/ui/src/components/visualizer/sync_navigation_button.ts index 7ae99888..d74bde91 100644 --- a/src/ui/src/components/visualizer/sync_navigation_button.ts +++ b/src/ui/src/components/visualizer/sync_navigation_button.ts @@ -113,14 +113,13 @@ export class SyncNavigationButton { SyncNavigationMode.MATCH_NODE_ID, SyncNavigationMode.VISUALIZER_CONFIG, SyncNavigationMode.UPLOAD_MAPPING_FROM_COMPUTER, - SyncNavigationMode.LOAD_MAPPING_FROM_CNS, ] : [ SyncNavigationMode.DISABLED, SyncNavigationMode.MATCH_NODE_ID, SyncNavigationMode.UPLOAD_MAPPING_FROM_COMPUTER, - SyncNavigationMode.LOAD_MAPPING_FROM_CNS, ]; + // If there is sync navigation data passed through visualizer config, set // the sync navigation data for the "visualizer config" mode and select the // mode by default. diff --git a/src/ui/src/components/visualizer/webgl_renderer.ts b/src/ui/src/components/visualizer/webgl_renderer.ts index d380e359..91e66c60 100644 --- a/src/ui/src/components/visualizer/webgl_renderer.ts +++ b/src/ui/src/components/visualizer/webgl_renderer.ts @@ -696,7 +696,12 @@ export class WebglRenderer implements OnInit, OnDestroy { data.nodeId, ); const mappedNode = this.curModelGraph.nodesById[mappedNodeId]; - if (mappedNode && mappedNode.id !== this.selectedNodeId) { + const hideInLayout = isOpNode(mappedNode) && mappedNode.hideInLayout; + if ( + mappedNode && + mappedNode.id !== this.selectedNodeId && + !hideInLayout + ) { this.revealNode(mappedNodeId, false); } }