feat(cpp/viz): split orphan TUs as separate fn entries (ADR 0003)
Cuando una funcion del registry parte su .cpp en varios TUs por testabilidad o separacion ImGui-vs-puro, cada TU adicional se registra como entrada propia con su .md en lugar de extender file_path para listar varios archivos. Aplicado a: - graph_labels_select_cpp_viz: helpers puros (compute_degrees + labels_select). - graph_viewport_selection_cpp_viz: clear/add/toggle/is_selected puros. - graph_types_cpp_viz: TU de update_bounds + find_node_by_user_data. graph_labels y graph_viewport actualizados para declarar las nuevas entradas en uses_functions. Razon detallada en docs/adr/0003 + regla actualizada en .claude/rules/uses_functions.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -233,12 +233,22 @@ bool graph_viewport(const char* id, GraphData& graph, GraphViewportState& state,
|
||||
}
|
||||
state.hovered_node = -1;
|
||||
if (hovered && graph.node_count > 0) {
|
||||
float hit_radius = 10.0f / state.zoom;
|
||||
int nearest = state.spatial->query_nearest(gx_mouse, gy_mouse, hit_radius);
|
||||
if (nearest >= 0) {
|
||||
state.hovered_node = nearest;
|
||||
graph.nodes[nearest].flags |= NF_HOVERED;
|
||||
interacted = true;
|
||||
// Spatial query con un radio amplio para descartar lo lejano; despues
|
||||
// refinamos comparando con el tamaño real (en world units) del nodo
|
||||
// candidato + un pequeño margen, asi el hover solo se activa cuando el
|
||||
// raton esta efectivamente sobre el nodo.
|
||||
float coarse_radius = 24.0f / state.zoom;
|
||||
float dist = 0.0f;
|
||||
int nearest = state.spatial->query_nearest(gx_mouse, gy_mouse, coarse_radius, &dist);
|
||||
if (nearest >= 0 && nearest < graph.node_count) {
|
||||
float node_r_px = resolve_node_size(graph.nodes[nearest],
|
||||
graph.types, graph.type_count);
|
||||
float hit_r_world = (node_r_px + 2.0f) / state.zoom; // 2 px margen
|
||||
if (dist <= hit_r_world) {
|
||||
state.hovered_node = nearest;
|
||||
graph.nodes[nearest].flags |= NF_HOVERED;
|
||||
interacted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user