Skip to content

Commit

Permalink
Merge pull request #213 from nextstrain/205-legend-fix
Browse files Browse the repository at this point in the history
Simple fix to legend toggle
  • Loading branch information
trvrb authored Feb 26, 2017
2 parents c9979da + 83ff885 commit 875bbba
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/tree/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class Legend extends React.Component {
}

getSVGHeight() {
if (!this.state.legendVisible) {
return 18;
}
let nItems = 10;
const titlePadding = 20;
if (this.props.colorScale.scale) {
Expand Down Expand Up @@ -169,12 +172,15 @@ class Legend extends React.Component {
);
});
}
// This gives the nice looking show/hide animation. Should restore while maintaining
// legend collapse functionality.
// <g style={{
// opacity: opacity,
// transform: `translate(0, ${offset}px)`,
// transition: `${fastTransitionDuration}ms ease-in-out`
// }}>
return (
<g style={{
opacity: opacity,
transform: `translate(0, ${offset}px)`,
transition: `${fastTransitionDuration}ms ease-in-out`
}}>
<g>
<rect width="280" height={this.getSVGHeight()} fill="rgba(255,255,255,.85)"/>
<g transform="translate(0,20)">
{items}
Expand Down

0 comments on commit 875bbba

Please sign in to comment.