data_table v1.3.1: Dots renderer via ImDrawList (font-independent) + recompile all apps with fn_table_viz (issue 0081-O.6)

- Replace TextColored+glyph with ImDrawList::AddCircleFilled in CellRenderer::Dots.
  Dots are now font-independent: no dependency on Unicode glyph coverage. Fixes
  "dots show as ?" on Karla/Roboto/Inter fonts that lack Geometric Shapes block.
- dots_glyph_size now controls circle radius (px) instead of font scale.
- BadgeRule.label is ignored for Dots (documented in data_table_types.h + docs).
- data_table.md bumped to v1.3.1 with capability growth log entry.
- docs/capabilities/data_table_renderers.md: Dots section updated + Common pitfalls
  entry added: "Asumir que cualquier glyph Unicode renderea".
- dag_engine_ui/tabs.cpp: removed stale "● glyph" comment from BadgeRule.
- Recompiled: dag_engine_ui, registry_dashboard, graph_explorer, navegator_dashboard,
  odr_console. All 5 apps deployed to Desktop/apps/. Build Linux + tests 4/4 green.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 17:35:22 +02:00
parent 4acf6986d3
commit 0b9af8f1bb
5 changed files with 55 additions and 34 deletions
+34 -25
View File
@@ -329,18 +329,14 @@ static void draw_cell_custom(const ColumnSpec& spec, const char* value,
case CellRenderer::Dots: {
// Parse cell value as separator-delimited tokens.
std::string s = value; // value is guaranteed non-null (checked at top)
std::string s = value;
std::vector<std::string> tokens;
{
std::string cur;
char sep = spec.dots_separator ? spec.dots_separator : ',';
for (char c : s) {
if (c == sep) {
tokens.push_back(cur);
cur.clear();
} else {
cur.push_back(c);
}
if (c == sep) { tokens.push_back(cur); cur.clear(); }
else cur.push_back(c);
}
if (!cur.empty()) tokens.push_back(cur);
}
@@ -348,33 +344,46 @@ static void draw_cell_custom(const ColumnSpec& spec, const char* value,
? std::min((int)tokens.size(), spec.dots_max)
: (int)tokens.size();
// Draw filled circles via ImDrawList — font-independent, scales with font size.
// BadgeRule.label is ignored for Dots (only relevant for Badge renderer).
float font_h = ImGui::GetTextLineHeight();
float radius = (spec.dots_glyph_size > 0.f ? spec.dots_glyph_size : font_h * 0.32f);
float spacing = radius * 2.3f;
ImVec2 origin = ImGui::GetCursorScreenPos();
float dot_y = origin.y + font_h * 0.5f;
ImDrawList* dl = ImGui::GetWindowDrawList();
ImU32 default_col = IM_COL32(110, 110, 125, 255); // muted grey
for (int t = 0; t < limit; ++t) {
if (t > 0) ImGui::SameLine(0, 2.0f); // tight spacing between dots
// Look up color + optional glyph override in badges.
ImVec4 color(0.4f, 0.4f, 0.45f, 1.0f); // default: muted grey
const char* glyph = u8"\xe2\x97\x8f"; // UTF-8 for ●
ImU32 col = default_col;
for (const auto& br : spec.badges) {
if (br.value == tokens[t]) {
ImVec4 c = hex_to_imcolor(br.color_hex);
if (c.x >= 0.f) color = c;
if (!br.label.empty()) glyph = br.label.c_str();
if (c.x >= 0.f) col = ImGui::ColorConvertFloat4ToU32(c);
break;
}
}
// Optional glyph size push.
bool pushed_font_scale = false;
if (spec.dots_glyph_size > 0.0f) {
float scale = spec.dots_glyph_size / ImGui::GetFontSize();
ImGui::SetWindowFontScale(scale);
pushed_font_scale = true;
}
ImGui::TextColored(color, "%s", glyph);
if (pushed_font_scale) ImGui::SetWindowFontScale(1.0f);
// Per-dot tooltip: show the token string.
if (spec.tooltip_on_hover && ImGui::IsItemHovered()) {
ImGui::SetTooltip("%s", tokens[t].c_str());
float cx = origin.x + radius + t * spacing;
dl->AddCircleFilled(ImVec2(cx, dot_y), radius, col, 18);
}
// Reserve cursor space so layout flows correctly.
float total_w = (limit > 0 ? (limit * spacing) : 0.f);
ImGui::Dummy(ImVec2(total_w, font_h));
// Hit-test for tooltip per dot.
if (spec.tooltip_on_hover && ImGui::IsItemHovered()) {
ImVec2 mp = ImGui::GetMousePos();
for (int t = 0; t < limit; ++t) {
float cx = origin.x + radius + t * spacing;
float dx = mp.x - cx, dy = mp.y - dot_y;
if (dx*dx + dy*dy <= radius * radius * 1.5f) {
ImGui::SetTooltip("%s", tokens[t].c_str());
break;
}
}
}
if (spec.dots_show_count) {
ImGui::SameLine(0, 6.0f);
ImGui::TextDisabled("(%d)", (int)tokens.size());