Skip to content

Commit

Permalink
Simple fix to legend toggle
Browse files Browse the repository at this point in the history
No longer beautiful. But functional. Fixes #205.
  • Loading branch information
trvrb committed Feb 26, 2017
1 parent c9979da commit 83ff885
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 83ff885

Please sign in to comment.