propagate events in Tooltip

old
Boris Mikhaylov 2016-01-22 14:20:22 +01:00
parent b2eca47c63
commit a11d1527c2
1 changed files with 6 additions and 6 deletions

View File

@ -24,22 +24,22 @@ const Tooltip = (ComposedComponent) => class extends React.Component {
active: false
};
handleMouseEnter = () => {
handleMouseEnter = (event) => {
if (this.timeout) clearTimeout(this.timeout);
this.timeout = setTimeout(() =>this.setState({active: true}), this.props.tooltipDelay);
if (this.props.onMouseEnter) this.props.onMouseEnter();
if (this.props.onMouseEnter) this.props.onMouseEnter(event);
};
handleMouseLeave = () => {
handleMouseLeave = (event) => {
if (this.timeout) clearTimeout(this.timeout);
if (this.state.active) this.setState({active: false});
if (this.props.onMouseLeave) this.props.onMouseLeave();
if (this.props.onMouseLeave) this.props.onMouseLeave(event);
};
handleClick = () => {
handleClick = (event) => {
if (this.timeout) clearTimeout(this.timeout);
if (this.props.tooltipHideOnClick) this.setState({active: false});
if (this.props.onClick) this.props.onClick();
if (this.props.onClick) this.props.onClick(event);
};
render () {