Conditional action inside mouse handler on d3 selection