Seems to work well:
<!DOCTYPE html>
<html>
<head>
<title>Minimal GoJS Sample</title>
<!-- Copyright 1998-2023 by Northwoods Software Corporation. -->
</head>
<body>
<div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:300px"></div>
<button id="myTestButton">Invoke <b>CommandHandler.scrollToPart</b></button>
<br>
Invoke it repeatedly to cycle through the selected (or highlighted) parts.
<script src="https://unpkg.com/gojs"></script>
<script id="code">
const $ = go.GraphObject.make;
const myDiagram =
$(go.Diagram, "myDiagramDiv",
{
"undoManager.isEnabled": true
});
myDiagram.groupTemplate =
$(go.Group, "Vertical",
{ isSubGraphExpanded: false },
$(go.Panel, "Horizontal",
$("SubGraphExpanderButton"),
$(go.TextBlock, new go.Binding("text"))
),
$(go.Placeholder, { padding: 10, background: "whitesmoke" })
);
myDiagram.model = new go.GraphLinksModel(
{
"nodeDataArray": [
{
"key": "SCREENID-4",
"text": "LetterforRecord.aspx",
"category": "Screen",
"isGroup": false,
"group": "GroupID-12",
"isButtonvisible": true
},
{
"key": "SCREENID-3",
"text": "LetterforRecord.aspx.designer",
"category": "Screen",
"isGroup": false,
"group": "GroupID-12",
"isButtonvisible": true
},
{
"key": "MissingProgramID-28",
"text": "LetterforRecord.aspx",
"category": "Missing Program",
"isGroup": false,
"group": "",
"isButtonvisible": true
},
{
"key": "GroupID-12",
"text": "OOSI_Web\OOSI_C\ReportWebPage",
"category": "Path",
"isGroup": true,
"group": "",
"isButtonvisible": false
},
],
});
const results = myDiagram.findNodesByExample({ text: /Record/ });
myDiagram.selectCollection(results);
document.getElementById("myTestButton").addEventListener("click", e => {
myDiagram.commandHandler.scrollToPart();
});
</script>
</body>
</html>