1
0
Fork 0

Always show a bar if there is a value

This commit is contained in:
Gregory Eremin 2015-03-14 23:19:25 +07:00
parent d89904e902
commit 33164e5773
1 changed files with 5 additions and 4 deletions

View File

@ -232,7 +232,8 @@ var Bar = React.createClass({
} }
this.setState({ this.setState({
labelX: labelX labelX: labelX,
barWidth: (this.props.item && this.props.width < 5 ? 5 : this.props.width)
}, this.animateAll); }, this.animateAll);
}, },
@ -245,7 +246,7 @@ var Bar = React.createClass({
this.clearAnimations(bar); this.clearAnimations(bar);
this.clearAnimations(underlay); this.clearAnimations(underlay);
this.clearAnimations(text); this.clearAnimations(text);
this.animate(bar, 'width', this.state.lastBarWidth, this.props.width); this.animate(bar, 'width', this.state.lastBarWidth, this.state.barWidth);
this.animate(bar, 'x', this.state.lastBarX, this.props.x); this.animate(bar, 'x', this.state.lastBarX, this.props.x);
this.animate(underlay, 'x', this.state.lastLabelX - padH, this.state.labelX - padH); this.animate(underlay, 'x', this.state.lastLabelX - padH, this.state.labelX - padH);
this.animate(text, 'x', this.state.lastLabelX, this.state.labelX); this.animate(text, 'x', this.state.lastLabelX, this.state.labelX);
@ -258,9 +259,9 @@ var Bar = React.createClass({
barX = (this.state.lastBarX && this.state.lastBarX !== this.props.x barX = (this.state.lastBarX && this.state.lastBarX !== this.props.x
? this.state.lastBarX ? this.state.lastBarX
: this.props.x), : this.props.x),
barWidth = (this.state.lastBarWidth && this.state.lastBarWidth !== this.props.width barWidth = (this.state.lastBarWidth && this.state.lastBarWidth !== this.state.barWidth
? this.state.lastBarWidth ? this.state.lastBarWidth
: this.props.width); : this.state.barWidth);
return ( return (
<g onClick={this.props.onClick}> <g onClick={this.props.onClick}>