Skip to content

Commit 6a4c4a3

Browse files
Jonathan ZakJonathan Zak
authored andcommitted
add assets for explain
1 parent c86da3d commit 6a4c4a3

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed

src/views/cytoscape/media/cytoscape-node-html-label.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/cytoscape/media/cytoscape.min.js

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/views/cytoscape/media/explain.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.codicon {
2+
font-size: 30px !important;
3+
color: #007acc;
4+
margin-bottom: 8px;
5+
/* margin-right: 8px; */
6+
}
7+
8+
.diagram-container {
9+
position: absolute;
10+
top: 0;
11+
left: 0;
12+
width: 100%;
13+
height: 100%;
14+
border: none;
15+
margin: 0;
16+
}

src/views/cytoscape/media/explain.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Initialize Cytoscape
2+
3+
// const vscode = acquireVsCodeApi();
4+
console.log("IN EXPLAIN.JS!!!")
5+
// @ts-ignore
6+
const cy = cytoscape({
7+
container: document.getElementById("diagramContainer"),
8+
// @ts-ignore
9+
elements: window.data,
10+
11+
style: [
12+
{
13+
selector: "node",
14+
style: {
15+
padding: "5px",
16+
height: "15px",
17+
width: "label",
18+
"background-color": "var(--vscode-list-activeSelectionBackground)",
19+
color: "var(--vscode-list-activeSelectionForeground)",
20+
label: "data(label)",
21+
"text-valign": "center",
22+
"font-size": "14px",
23+
},
24+
},
25+
{
26+
selector: "edge",
27+
style: {
28+
width: 2,
29+
"line-color": "#5c96bc",
30+
"target-arrow-color": "#5c96bc",
31+
"target-arrow-shape": "triangle",
32+
"curve-style": "bezier",
33+
},
34+
},
35+
],
36+
37+
// Layout options
38+
layout: {
39+
name: "breadthfirst",
40+
directed: true, // Directional tree
41+
padding: 10, // Padding around the graph
42+
spacingFactor: 1.5, // Spacing between nodes
43+
},
44+
});
45+
46+
// Add click event to show alert for nodes
47+
cy.on("tap", "node", function (evt) {
48+
const id = evt.target.id();
49+
// vscode.postMessage({
50+
// command: 'selected',
51+
// nodeId: id
52+
// });
53+
});
54+
55+
const getCodiconClass = (label) => {
56+
const codiconClass = new Map([["d", "d"]]);
57+
return codiconClass.get(label);
58+
};
59+
60+
// cy.nodeHtmlLabel([
61+
// {
62+
// query: ".l1",
63+
// valign: "top",
64+
// halign: "center",
65+
// valignBox: "top",
66+
// halignBox: "center",
67+
// tpl: function (data) {
68+
// const className = getCodiconClass(data.label);
69+
// return `<div><div class="icon"><i class="codicon ${className}"></i></div>`;
70+
// },
71+
// },
72+
// ]);

0 commit comments

Comments
 (0)