Skip to content

Commit

Permalink
Merge pull request #9 from dandelany/bugfix-button-zdepth
Browse files Browse the repository at this point in the history
fix issue with button zdepth not being reset correctly

Thanks Dan!
  • Loading branch information
Hai Nguyen committed Oct 24, 2014
2 parents 8d22551 + 875b0ad commit af1f8a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/dist/js/paper-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ var PaperButton = React.createClass({
},

getInitialState: function() {
return { zDepth: this.props.disabled ? 0 : zDepths[this.props.type] }
var zDepth = this.props.disabled ? 0 : zDepths[this.props.type];
return { zDepth: zDepth, initialZDepth: zDepth };
},

render: function() {
Expand Down Expand Up @@ -87,7 +88,6 @@ var PaperButton = React.createClass({
var $el = $(this.getDOMNode()),
$ripple = $(this.refs.ripple.getDOMNode()),
$offset = $el.offset(),
originalZDepth = this.state.zDepth,
x = e.pageX - $offset.left,
y = e.pageY - $offset.top;

Expand All @@ -103,9 +103,9 @@ var PaperButton = React.createClass({

//animate the zdepth change
if (this.props.type !== Types.FLAT) {
this.setState({ zDepth: originalZDepth + 1 });
this.setState({ zDepth: this.state.initialZDepth + 1 });
CssEvent.onTransitionEnd($el, function() {
this.setState({ zDepth: originalZDepth });
this.setState({ zDepth: this.state.initialZDepth });
}.bind(this));
}
}
Expand Down

0 comments on commit af1f8a3

Please sign in to comment.