Skip to content

Commit

Permalink
node def switch: change hovering state only when editing node def (#1548
Browse files Browse the repository at this point in the history
)

Co-authored-by: Stefano Ricci <[email protected]>
  • Loading branch information
SteRiccio and SteRiccio authored Jun 29, 2021
1 parent 488ed89 commit 64a9848
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions webapp/components/survey/SurveyForm/nodeDefs/nodeDefSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,19 @@ class NodeDefSwitch extends React.Component {
}

onMouseEnter() {
this.setState({ isHovering: true })
this.setIsHovering(true)
}

onMouseLeave() {
this.setState({ isHovering: false })
this.setIsHovering(false)
}

setIsHovering(isHovering) {
const { edit, canEditDef } = this.props

if (edit && canEditDef) {
this.setState({ isHovering })
}
}

render() {
Expand Down

0 comments on commit 64a9848

Please sign in to comment.