Spaces:
Running
Running
Update templates/index.html
Browse files- templates/index.html +10 -4
templates/index.html
CHANGED
@@ -61,7 +61,14 @@
|
|
61 |
const y = vector[1] * 10; // level
|
62 |
const z = vector[2] * 100; // center_pos
|
63 |
positions.push(x, y, z);
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
part.pointIndex = index * 3; // Store index for lookup
|
66 |
});
|
67 |
|
@@ -111,8 +118,8 @@
|
|
111 |
const part = window.parts.find(p => p.pointIndex === index * 3);
|
112 |
if (part && hoveredPoint !== part) {
|
113 |
hoveredPoint = part;
|
114 |
-
const variableRole = part.
|
115 |
-
|
116 |
pointDetails.innerHTML = `
|
117 |
<div class="text-gray-200">
|
118 |
<strong>Category:</strong> ${part.category}<br>
|
@@ -121,7 +128,6 @@
|
|
121 |
<strong>Level:</strong> ${part.level}<br>
|
122 |
<strong>Location:</strong> Lines ${part.location[0]} to ${part.location[1]}<br>
|
123 |
<strong>Variable Role:</strong> ${variableRole}<br>
|
124 |
-
<strong>Variable Name:</strong> ${variableName}<br>
|
125 |
<strong>Vector:</strong> [${part.vector.join(', ')}]<br>
|
126 |
<strong>Code:</strong><pre class="text-xs text-gray-300">${part.source}</pre>
|
127 |
</div>
|
|
|
61 |
const y = vector[1] * 10; // level
|
62 |
const z = vector[2] * 100; // center_pos
|
63 |
positions.push(x, y, z);
|
64 |
+
// Color by category (e.g., variables in blue, others in orange)
|
65 |
+
let color;
|
66 |
+
if (['input_variable', 'assigned_variable', 'returned_variable'].includes(part.category)) {
|
67 |
+
color = [0, 0, 1]; // Blue for variables
|
68 |
+
} else {
|
69 |
+
color = [1, 0.5, 0]; // Orange for non-variables
|
70 |
+
}
|
71 |
+
colors.push(...color);
|
72 |
part.pointIndex = index * 3; // Store index for lookup
|
73 |
});
|
74 |
|
|
|
118 |
const part = window.parts.find(p => p.pointIndex === index * 3);
|
119 |
if (part && hoveredPoint !== part) {
|
120 |
hoveredPoint = part;
|
121 |
+
const variableRole = part.category in ['input_variable', 'assigned_variable', 'returned_variable'] ?
|
122 |
+
part.category.replace('_variable', '').capitalize() : '-';
|
123 |
pointDetails.innerHTML = `
|
124 |
<div class="text-gray-200">
|
125 |
<strong>Category:</strong> ${part.category}<br>
|
|
|
128 |
<strong>Level:</strong> ${part.level}<br>
|
129 |
<strong>Location:</strong> Lines ${part.location[0]} to ${part.location[1]}<br>
|
130 |
<strong>Variable Role:</strong> ${variableRole}<br>
|
|
|
131 |
<strong>Vector:</strong> [${part.vector.join(', ')}]<br>
|
132 |
<strong>Code:</strong><pre class="text-xs text-gray-300">${part.source}</pre>
|
133 |
</div>
|