Fix expand button click in interactive family tree

The renderTreeFromId click handler was missing the expand
indicator logic, so clicking the "+" button didn't work.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-02 20:37:46 -05:00
parent 42cc5892a9
commit 4f5868366a
@@ -1779,7 +1779,7 @@ function renderTreeFromId(personId, animate = true) {
this.appendChild(card);
});
// Single click: handle info button
// Single click: handle info button and expand
nodes.on('click', (event, d) => {
event.stopPropagation();
@@ -1791,8 +1791,21 @@ function renderTreeFromId(personId, animate = true) {
if (isInfoClick) {
showPersonInfo(d.data);
return;
}
// Check if clicking on the expand indicator
const isExpandClick = target.classList.contains('expand-indicator') ||
target.classList.contains('expand-icon');
// Check if node can be expanded/collapsed
const hasHiddenChildren = d._children && d._children.length > 0;
const hasExpandableChildren = d.data.data && d.data.data.hasChildren && !d.children && !d._children;
const canExpand = hasHiddenChildren || hasExpandableChildren;
if (isExpandClick && canExpand) {
toggleNode(d);
}
// Clicking elsewhere does nothing (use info button or double-click)
});
// Double click: re-center