diff --git a/src/builder.js b/src/builder.js index 1991f74..5860654 100644 --- a/src/builder.js +++ b/src/builder.js @@ -157,14 +157,22 @@ class TreeBuilder { if (d.data.hidden) { return; } - opts.callbacks.nodeClick(d.data.name, d.data.extra, d.data.id); + if (d.data.isMarriage) { + opts.callbacks.marriageClick(d.data.extra, d.data.id) + } else { + opts.callbacks.nodeClick(d.data.name, d.data.extra, d.data.id) + } }) .on('contextmenu', function(d)  { if (d.data.hidden) { return; } d3.event.preventDefault(); - opts.callbacks.nodeRightClick(d.data.name, d.data.extra, d.data.id); + if (d.data.isMarriage) { + opts.callbacks.marriageRightClick(d.data.extra, d.data.id) + } else { + opts.callbacks.nodeRightClick(d.data.name, d.data.extra, d.data.id) + } }); } diff --git a/src/dtree.js b/src/dtree.js index d59ae27..4883e3f 100644 --- a/src/dtree.js +++ b/src/dtree.js @@ -15,6 +15,8 @@ const dTree = { callbacks: { nodeClick: function(name, extra, id) {}, nodeRightClick: function(name, extra, id) {}, + marriageClick: function(extra, id) {}, + marriageRightClick: function(extra, id) {}, nodeHeightSeperation: function(nodeWidth, nodeMaxHeight) { return TreeBuilder._nodeHeightSeperation(nodeWidth, nodeMaxHeight); },