Skip to content

Commit

Permalink
Restore on-hover branch colour emphasis
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Feb 5, 2024
1 parent d6bd290 commit b4db575
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/components/tree/phyloTree/renderers.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,29 +343,18 @@ export const updateColorBy = function updateColorBy() {};
*/
const handleBranchHoverColor = (d, c1, c2) => {
if (!d) { return; }
const id = `T${d.that.id}_${d.n.parent.arrayIdx}_${d.n.arrayIdx}`;

/* We want to emphasize the colour of the branch. How we do this depends on how the branch was rendered in the first place! */
const tel = d.that.svg.select(getDomId("#branchT", d.n.name));

const tel = d.that.svg.select("#"+getDomId("branchT", d.n.name));
if (!tel.empty()) { // Some displays don't have S & T parts of the branch
tel.style("stroke", c2);
}
const sel = d.that.svg.select(getDomId("#branchS", d.n.name));

/* If we reinstate gradient stem colours this section must be updated; see the
commit which added this comment for the previous implementation */
const sel = d.that.svg.select("#"+getDomId("branchS", d.n.name));
if (!sel.empty()) {
if (d.branchStroke === d.n.parent.shell.branchStroke) {
sel.style("stroke", c2);
} else {
// console.log("going to gradient " + el.attr("id"));
const begin = d.that.svg.select(`#${id}_begin`);
if (begin) {
begin.attr("stop-color", c1);
}
const end = d.that.svg.select(`#${id}_end`);
if (end) {
end.attr("stop-color", c2);
}
}
sel.style("stroke", c2);
}
};

Expand Down

0 comments on commit b4db575

Please sign in to comment.