Skip to content

Commit 2565466

Browse files
committed
Clean up old code
1 parent fd62b7c commit 2565466

File tree

5 files changed

+6
-91
lines changed

5 files changed

+6
-91
lines changed

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

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/views/cytoscape/media/explain.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/* .codicon {
2-
font-size: 30px !important;
3-
color: #007acc;
4-
margin-bottom: 8px;
5-
} */
61

72
.diagram-container {
83
position: absolute;

src/views/cytoscape/media/explain.js

Lines changed: 6 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
// Initialize Cytoscape
2-
// main.js
1+
// @ts-nocheck
32
import { getTooltipPosition } from "./graphUtils.js";
43
import {
54
deleteAllBorders,
65
drawBorderAndIconForEachExplainNode,
7-
} from "./borderDraw.js";
8-
// // @ts-ignore
9-
// const iconMap = window.iconMap;
10-
// @ts-ignore
6+
} from "./borderAndIconDraw.js";
7+
118
const tooltips = window.tooltips;
12-
// @ts-ignore
139
const vscode = window.acquireVsCodeApi();
14-
// @ts-ignore
10+
11+
// Initialize Cytoscape
1512
const cy = cytoscape({
1613
container: document.getElementById("diagramContainer"),
17-
// @ts-ignore
1814
elements: window.data,
19-
2015
style: [
2116
{
2217
selector: "node",
@@ -43,95 +38,22 @@ const cy = cytoscape({
4338
},
4439
],
4540

46-
// Layout options
4741
layout: {
4842
name: "grid",
4943
padding: 50, // Padding around the graph
5044
spacingFactor: 0.9, // Spacing between nodes
5145
},
5246
});
5347

54-
// Add click event to show alert for nodes
48+
// When clicked, we display the details for the node in the bottom tree view
5549
cy.on("tap", "node", function (evt) {
5650
const id = evt.target.id();
57-
// @ts-ignore
5851
vscode.postMessage({
5952
command: "selected",
6053
nodeId: id,
6154
});
6255
});
6356

64-
// const getCodiconClass = (label) => {
65-
// const className = iconMap[label];
66-
// return className !== undefined ? `codicon-${className}` : "";
67-
// };
68-
69-
// cy.nodeHtmlLabel([
70-
// {
71-
// query: ".l1",
72-
// valign: "top",
73-
// halign: "center",
74-
// valignBox: "top",
75-
// halignBox: "center",
76-
// tpl: function (data) {
77-
// const className = getCodiconClass(data.label);
78-
// return `<div><div class="icon"><i class="codicon ${className}"></i></div>`;
79-
// },
80-
// },
81-
// ]);
82-
83-
// cy.nodes().on("mouseover", (event) => {
84-
// const node = event.target;
85-
// const id = node.id();
86-
// const tooltip = tooltips[id];
87-
// const hoverDiv = document.createElement("pre");
88-
// hoverDiv.innerText = tooltip;
89-
// hoverDiv.className = "hover-box";
90-
// document.body.appendChild(hoverDiv);
91-
92-
// function updatePosition() {
93-
// const { x, y } = node.renderedPosition(); // center of node
94-
// const containerRect = cy.container().getBoundingClientRect(); // Cytoscape canvas
95-
// const boxRect = hoverDiv.getBoundingClientRect(); // Tooltip box
96-
// const boxWidth = boxRect.width;
97-
// const boxHeight = boxRect.height;
98-
99-
// const nodeTopY = y - node.renderedOuterHeight() / 2;
100-
// const offset = 20;
101-
102-
// let top = nodeTopY + containerRect.top - boxHeight - offset;
103-
// let left = x + containerRect.left - boxWidth / 2;
104-
105-
// // Constrain to visible area
106-
// const viewportWidth = window.innerWidth;
107-
// const viewportHeight = window.innerHeight;
108-
109-
// // Keep inside horizontal bounds
110-
// if (left < 4) left = 4;
111-
// if (left + boxWidth > viewportWidth - 4) {
112-
// left = viewportWidth - boxWidth - 4;
113-
// }
114-
115-
// // If tooltip would be cut off vertically, show it *below* the node instead
116-
// if (top < 4) {
117-
// top = y + containerRect.top + node.renderedOuterHeight() / 2;
118-
// }
119-
120-
// hoverDiv.style.left = `${left}px`;
121-
// hoverDiv.style.top = `${top}px`;
122-
// }
123-
124-
// updatePosition(); // initial position
125-
// cy.on("pan zoom resize", updatePosition);
126-
// node.on("position", updatePosition);
127-
128-
// node.once("mouseout", () => {
129-
// hoverDiv.remove();
130-
// cy.off("pan zoom resize", updatePosition);
131-
// node.off("position", updatePosition);
132-
// });
133-
// });
134-
13557
// === Tooltip Hover Handler ===
13658
cy.nodes().on("mouseover", (event) => {
13759
const node = event.target;

src/views/cytoscape/media/graphUtils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export function getBorderWidthAndHeight(
4242
}
4343

4444
// === Tooltip Position Utility ===
45-
4645
export function getTooltipPosition(node, container, tooltipBox) {
4746
const { x, y } = node.renderedPosition();
4847
const containerRect = container.getBoundingClientRect();

0 commit comments

Comments
 (0)