Skip to content

Commit

Permalink
legend hover now affects tips if value is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshadfield committed Apr 16, 2018
1 parent 8c8b349 commit c19fff6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/actions/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const updateTipRadii = (
const idx = strainNameToIdx(treeToo.nodes, tree.nodes[tipSelectedIdx].strain);
d.dataToo = calcTipRadii({idx, colorScale, tree: treeToo});
}
} else if (selectedLegendItem) {
} else if (selectedLegendItem !== false) {
d.data = calcTipRadii({selectedLegendItem, colorScale, tree});
if (tt) d.dataToo = calcTipRadii({selectedLegendItem, colorScale, tree: treeToo});
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/util/tipRadiusHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const determineLegendMatch = (selectedLegendItem, node, colorScale) => {
const nodeAttr = getTipColorAttribute(node, colorScale);
if (colorScale.continuous) {
return (nodeAttr <= colorScale.legendBounds[selectedLegendItem][1]) &&
(nodeAttr > colorScale.legendBounds[selectedLegendItem][0]);
(nodeAttr >= colorScale.legendBounds[selectedLegendItem][0]);
}
return nodeAttr === selectedLegendItem;
};
Expand All @@ -30,7 +30,7 @@ const determineLegendMatch = (selectedLegendItem, node, colorScale) => {
* @returns null (if data not ready) or array of tip radii
*/
export const calcTipRadii = ({tipSelectedIdx = false, selectedLegendItem = false, colorScale, tree}) => {
if (selectedLegendItem && tree && tree.nodes) {
if (selectedLegendItem !== false && tree && tree.nodes) {
return tree.nodes.map((d) => determineLegendMatch(selectedLegendItem, d, colorScale) ? tipRadiusOnLegendMatch : tipRadius);
} else if (tipSelectedIdx) {
const radii = tree.nodes.map(() => tipRadius);
Expand Down

0 comments on commit c19fff6

Please sign in to comment.