mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user