Spaces:
Configuration error
Configuration error
fix: better folder graph layout — bigger nodes, always-on labels, wider spring
Browse files2093 unmodified lines20942095209620972097209820992100210121022103210421012102210521062107210821042109211021112112198 unmodified lines2311231223132309231423152316231731 unmodified lines23492350235123472352235323542355167 unmodified lines252325242525252125262527252825292530253158 unmodified lines2590259125922586259325942595259625972093 unmodified lines
graphSim.nodes = state.graph.nodes.map(function(n, i) {
var angle = (2 * Math.PI * i) / Math.max(state.graph.nodes.length, 1);
var radius = Math.min(cw, ch) * 0.3;
var radius = Math.min(cw, ch) * 0.38;
var deg = edgeMap[n.id] || 0;
var activity = ((n.sessions && n.sessions.length) || 0) + ((n.memories && n.memories.length) || 0);
var nodeR = n.type === 'folder'
? Math.max(24, Math.min(52, 24 + Math.sqrt(activity + 1) * 3.5))
: Math.max(10, Math.min(26, 10 + deg * 2.5));
return {
id: n.id, type: n.type, name: n.name, properties: n.properties,
x: Math.cos(angle) * radius + (Math.random() - 0.5) * 50,
y: Math.sin(angle) * radius + (Math.random() - 0.5) * 50,
sessions: n.sessions, memories: n.memories,
x: Math.cos(angle) * radius,
y: Math.sin(angle) * radius,
vx: 0, vy: 0,
r: Math.max(8, Math.min(22, 8 + deg * 2.5))
r: nodeR
};
});
graphSim.edges = state.graph.edges.slice();198 unmodified lines graphSim.tickCount = (graphSim.tickCount || 0) + 1;
var coolBoost = Math.min(0.4, graphSim.tickCount / 1500);
var damping = 0.9 - coolBoost;
var repulsion = nodeCount > 1000 ? 3000 : nodeCount > 100 ? 2000 : nodeCount > 50 ? 1200 : 800;
var repulsion = nodeCount > 1000 ? 3000 : nodeCount > 100 ? 2000 : nodeCount > 50 ? 1800 : nodeCount > 10 ? 3500 : 6000;
var attraction = nodeCount > 100 ? 0.002 : 0.005;
var centerGravity = nodeCount > 1000 ? 0.012 : nodeCount > 100 ? 0.005 : 0.01;
var velocityCap = nodeCount > 1000 ? 6 : nodeCount > 200 ? 12 : 24;31 unmodified lines var dx = t.x - s.x;
var dy = t.y - s.y;
var dist = Math.sqrt(dx * dx + dy * dy) || 1;
var f = (dist - 100) * attraction;
var f = (dist - (s.type === 'folder' || t.type === 'folder' ? 220 : 100)) * attraction;
var fx = (dx / dist) * f;
var fy = (dy / dist) * f;
if (graphSim.dragNode !== s) { s.vx += fx; s.vy += fy; }167 unmodified lines ctx.fill();
}
var showEdgeLabel = e.type && !edgeDimmed && (isConnectedToFocus ? graphSim.zoom > 0.6 : graphSim.zoom > edgeLabelZoomThreshold);
var showEdgeLabel = e.type && !edgeDimmed && (
s.type === 'folder' || t.type === 'folder' || isConnectedToFocus ? graphSim.zoom > 0.4 : graphSim.zoom > edgeLabelZoomThreshold
);
if (showEdgeLabel) {
var zoomInv = 1 / graphSim.zoom;
ctx.save();58 unmodified lines ctx.stroke();
}
var showLabel = matchesSearch && !isFocusFaded && (
var showLabel = !isFocusFaded && (
n.type === 'folder' ||
isSelected || isHovered ||
(searchActive && matchesSearch) ||
(!isDense && graphSim.zoom > labelZoomThreshold) ||src/viewer/index.html+16-8