Skip to content

Commit 37e9b2a

Browse files
committed
clean up code
1 parent ea5e7a4 commit 37e9b2a

File tree

4 files changed

+18
-72
lines changed

4 files changed

+18
-72
lines changed

media/explain/borderAndIconDraw.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export function deleteAllBorders() {
99
document.querySelectorAll(".border").forEach((el) => el.remove());
1010
}
1111

12-
// @ts-ignore
1312
const iconMap = window.iconMap;
1413

1514
const getCodiconClass = (label) => {

media/explain/explain.css

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1-
2-
/* .diagram-container {
3-
position: absolute;
4-
top: 0;
5-
left: 0;
6-
width: 100%;
7-
height: 100%;
8-
border: none;
9-
margin: 0;
10-
} */
11-
12-
.diagram-container{
13-
position: absolute;
14-
top: 0;
15-
box-sizing: border-box;
16-
left: 0;
17-
right: 0;
18-
bottom: 0;
19-
height: 100%;
20-
overflow: hidden;
21-
height: 100%;
22-
border: none;
23-
margin: 0;
24-
/* border: 2px solid red; */
1+
.diagram-container {
2+
position: absolute;
3+
margin: 0;
4+
top: 0;
5+
left: 0;
6+
right: 0;
7+
bottom: 0;
8+
height: 100%;
9+
overflow: hidden;
10+
border: none;
11+
box-sizing: border-box;
2512
}
2613

27-
2814
.hover-box {
2915
border-radius: 6px;
3016
padding: 6px 10px;
@@ -44,8 +30,7 @@
4430
}
4531

4632
.border {
47-
border: 3px solid #007acc;
48-
pointer-events: none;
33+
pointer-events: none;
4934
}
5035

5136
.warning-div {

media/explain/explain.js

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,19 @@ if (isWindowTooSmall(GRAPH_PADDING)) {
2525
style: [
2626
{
2727
selector: "node",
28-
// style: {
29-
// padding: "5px",
30-
// height: "15px",
31-
// width: "label",
32-
// "background-color": "var(--vscode-list-activeSelectionBackground)",
33-
// color: "var(--vscode-list-activeSelectionForeground)",
34-
// label: "data(label)",
35-
// "text-valign": "center",
36-
// "font-size": "14px",
37-
// },
3828
style: {
3929
padding: "5px",
40-
width: "150px", // fixed width
30+
width: "150px",
4131
shape: "roundrectangle",
4232
"background-color": "lightgray",
4333
color: "var(--vscode-list-activeSelectionForeground)",
4434
label: "data(label)",
45-
"text-wrap": "wrap", // enable wrapping
46-
"text-max-width": "150px", // must match or be less than width
35+
"text-wrap": "wrap",
36+
"text-max-width": "150px",
4737
"text-valign": "center",
4838
"text-halign": "center",
4939
"font-size": "14px",
5040
"line-height": "1.2",
51-
// "text-overflow-wrap": "anywhere",
5241
},
5342
},
5443
{
@@ -70,41 +59,14 @@ if (isWindowTooSmall(GRAPH_PADDING)) {
7059
avoidOverlap: true, // prevents node overlap, may overflow boundingBox if not enough space
7160
avoidOverlapPadding: 10, // extra spacing around nodes when avoidOverlap: true
7261
nodeDimensionsIncludeLabels: false, // Excludes the label when calculating node bounding boxes for the layout algorithm
73-
spacingFactor: undefined, // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
7462
condense: false, // uses all available space on false, uses minimal space on true
75-
rows: undefined, // force num of rows in the grid
76-
cols: undefined, // force num of columns in the grid
77-
position: function (node) {}, // returns { row, col } for element
78-
sort: undefined, // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
7963
animate: false, // whether to transition the node positions
80-
animationDuration: 500, // duration of animation in ms if enabled
81-
animationEasing: undefined, // easing of animation if enabled
82-
animateFilter: function (node, i) {
83-
return true;
84-
}, // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
85-
ready: undefined, // callback on layoutready
86-
stop: undefined, // callback on layoutstop
87-
transform: function (node, position) {
88-
return position;
89-
}, // transform a given node position. Useful for changing flow direction in discrete layouts
9064
},
91-
92-
// layout: {
93-
// name: "breadthfirst",
94-
// fit: true, // whether to fit the viewport to the graph
95-
// directed: false,
96-
// padding: GRAPH_PADDING, // paddinsg used on fit
97-
// boudingBox: { x1: 0, y1: 0, w: window.innerWidth, h: window.innerHeight },
98-
// circle: false, // put depths in concentric circles if true, put depths top down if false
99-
// grid: false,
100-
// avoidOverlap: true,
101-
// nodeDimensionsIncludeLabels: false, // Excludes the label when calculating node bounding boxes for the layout algorithm
102-
// },
10365
});
10466

10567
window.addEventListener("resize", () => {
106-
cy.resize(); // Resize Cytoscape's canvas
107-
cy.fit(cy.nodes().boundingBox(), GRAPH_PADDING); // Optional: Fit all nodes back into view
68+
cy.resize();
69+
cy.fit(cy.nodes().boundingBox(), GRAPH_PADDING);
10870
cy.center();
10971
});
11072

src/views/cytoscape/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class CytoscapeGraph {
3535
constructor() {}
3636

3737
addNode(node: NewNode): string {
38-
const id = randomId(); // TODO: is this unique enough?
38+
const id = randomId();
3939

4040
if (node.data) {
4141
this.elementData.set(id, node.data);

0 commit comments

Comments
 (0)