Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue with button zdepth not being reset correctly #9

Merged
merged 1 commit into from
Oct 24, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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