UNPKG

lost-sia

Version:

Single Image Annotation Tool

2 lines (1 loc) 1.34 kB
import{jsxs as n,jsx as t}from"react/jsx-runtime";import{Component as p}from"react";/* empty css */class l extends p{constructor(s){super(s),this.state={haloCss:"node-halo-off"}}componentDidUpdate(){}onMouseOver(s){this.props.isSelected&&this.setState({haloCss:"node-halo-on"})}onMouseLeave(s){this.props.isSelected&&this.setState({haloCss:"node-halo-off"})}onMouseDown(s){this.props.onMouseDown&&this.props.onMouseDown(s,this.props.idx)}onMouseUp(s){s.stopPropagation()}render(){let s,e;if(this.props.closingEdge){if(this.props.idx===0&&this.props.anno.length===1)return null;s=this.props.anno[this.props.anno.length-1],e=this.props.anno[0]}else{if(this.props.idx-1<0||this.props.idx>this.props.anno.length-1)return null;s=this.props.anno[this.props.idx-1],e=this.props.anno[this.props.idx]}return n("g",{onMouseOver:o=>{this.onMouseOver(o)},onMouseLeave:o=>{this.onMouseLeave(o)},children:[t("line",{x1:s.x,y1:s.y,x2:e.x,y2:e.y,stroke:"black",strokeWidth:this.props.style.strokeWidth*3,className:this.state.haloCss,onMouseOver:o=>{this.onMouseOver(o)},onMouseDown:o=>this.onMouseDown(o),onMouseUp:o=>this.onMouseUp(o)}),t("line",{x1:s.x,y1:s.y,x2:e.x,y2:e.y,stroke:"black",style:this.props.style,className:this.props.className,onMouseDown:o=>this.onMouseDown(o),onMouseUp:o=>this.onMouseUp(o)})]})}}export{l as default};