File size: 1,310 Bytes
597ee18 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import React from 'react';
/**
* This renders the name of a keypoint and its current visibility setting.
*/
export class KeypointInfo extends React.Component {
constructor(props) {
super(props);
this.onVisibilityChange = this.onVisibilityChange.bind(this);
}
onVisibilityChange(visibility){
this.props.visibilityChanged(this.props.id, visibility);
}
render(){
let radio_name = this.props.name + " vis_anno_" + this.props.annotation_id;
return (
<tr>
<th scope="row"><span className="badge" style={{backgroundColor: this.props.color}}>○</span> {this.props.name}</th>
<td>
<input
type="radio" aria-label="n/a" value="0"
name={radio_name} checked={this.props.visibility == 0}
onChange={(e) => this.onVisibilityChange(0)} />
</td>
<td>
<input type="radio" aria-label="occluded" value="1"
name={radio_name} checked={this.props.visibility == 1}
onChange={(e) => this.onVisibilityChange(1)} />
</td>
<td>
<input type="radio" aria-label="visible" value="2"
name={radio_name} checked={this.props.visibility == 2}
onChange={(e) => this.onVisibilityChange(2)} />
</td>
</tr>
);
}
} |