Spaces:
Configuration error
Configuration error
fix: better folder graph layout — bigger nodes, always-on labels, wider spring
Browse files2093 unmodified lines20942095209620972098209921002101210221032104210521062107198 unmodified lines230623072308230923102311231231 unmodified lines2344234523462347234823492350167 unmodified lines251825192520252125222523252458 unmodified lines25832584258525862587258825892093 unmodified linesgraphSim.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 deg = edgeMap[n.id] || 0;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,vx: 0, vy: 0,r: Math.max(8, Math.min(22, 8 + deg * 2.5))};});graphSim.edges = state.graph.edges.slice();198 unmodified linesgraphSim.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 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 linesvar 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 fx = (dx / dist) * f;var fy = (dy / dist) * f;if (graphSim.dragNode !== s) { s.vx += fx; s.vy += fy; }167 unmodified linesctx.fill();}var showEdgeLabel = e.type && !edgeDimmed && (isConnectedToFocus ? graphSim.zoom > 0.6 : graphSim.zoom > edgeLabelZoomThreshold);if (showEdgeLabel) {var zoomInv = 1 / graphSim.zoom;ctx.save();58 unmodified linesctx.stroke();}var showLabel = matchesSearch && !isFocusFaded && (isSelected || isHovered ||(searchActive && matchesSearch) ||(!isDense && graphSim.zoom > labelZoomThreshold) ||2093 unmodified lines2094209520962097209820992100210121022103210421052106210721082109211021112112198 unmodified lines231123122313231423152316231731 unmodified lines2349235023512352235323542355167 unmodified lines25232524252525262527252825292530253158 unmodified lines259025912592259325942595259625972093 unmodified linesgraphSim.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.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,sessions: n.sessions, memories: n.memories,x: Math.cos(angle) * radius,y: Math.sin(angle) * radius,vx: 0, vy: 0,r: nodeR};});graphSim.edges = state.graph.edges.slice();198 unmodified linesgraphSim.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 ? 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 linesvar dx = t.x - s.x;var dy = t.y - s.y;var dist = Math.sqrt(dx * dx + dy * dy) || 1;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 linesctx.fill();}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 linesctx.stroke();}var showLabel = !isFocusFaded && (n.type === 'folder' ||isSelected || isHovered ||(searchActive && matchesSearch) ||(!isDense && graphSim.zoom > labelZoomThreshold) ||
src/viewer/index.html+16-8