Improve bio card: profile button, touch support, root-click navigation
Replace the "View profile" link with icon action buttons in the bio card top-right corner. On touch devices, single tap shows the bio card (with focus + profile buttons), double tap speed-focuses in the diagram. On desktop, click navigates the diagram and hover shows the bio card. Clicking the root/focused person now navigates to their profile page. Tapping the SVG background or the same card again dismisses the tooltip.
This commit is contained in:
@@ -35,6 +35,7 @@ export default class Chart {
|
||||
this.zoomBehavior = zoomBehavior;
|
||||
|
||||
svg.on("zoom.tooltip", () => hideTooltip());
|
||||
svg.on("click.tooltip", () => hideTooltip());
|
||||
createZoomControls(ctr, svg, zoomBehavior);
|
||||
|
||||
const canvas = getCanvas(svg);
|
||||
@@ -46,12 +47,16 @@ export default class Chart {
|
||||
this.config
|
||||
);
|
||||
|
||||
// Click handler
|
||||
// Click handler — root person goes to profile, others reload diagram
|
||||
const baseUrl = this.baseUrl;
|
||||
const mainId = this.data.mainId;
|
||||
const onNodeClick = (data) => {
|
||||
hideTooltip();
|
||||
const url = baseUrl.replace("__XREF__", data.id);
|
||||
window.location.href = url;
|
||||
if (data.id === mainId && data.url) {
|
||||
window.location.href = data.url;
|
||||
} else {
|
||||
window.location.href = baseUrl.replace("__XREF__", data.id);
|
||||
}
|
||||
};
|
||||
|
||||
// Draw connections first (behind cards)
|
||||
|
||||
Reference in New Issue
Block a user