diff options
| author | Andrew Kim <andrewdkim@users.noreply.github.com> | 2019-03-05 10:35:11 -0500 |
|---|---|---|
| committer | Andrew Kim <andrewdkim@users.noreply.github.com> | 2019-03-05 10:35:11 -0500 |
| commit | f9ec063ac57061b0b6ee9df901773401f98f87e6 (patch) | |
| tree | 2ed514ef5bcfbbffa0a082b40b240c43e75f2e5f /src/views/nodes/Annotation.tsx | |
| parent | 094b766c7d3097180a6022273001d08672456ef8 (diff) | |
object structure
Diffstat (limited to 'src/views/nodes/Annotation.tsx')
| -rw-r--r-- | src/views/nodes/Annotation.tsx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/views/nodes/Annotation.tsx b/src/views/nodes/Annotation.tsx index 0ba05ba3d..a2c7be1a8 100644 --- a/src/views/nodes/Annotation.tsx +++ b/src/views/nodes/Annotation.tsx @@ -9,6 +9,8 @@ interface IProps{ X: number; Y: number; Highlights: any[]; + Annotations: any[]; + CurrAnno: any[]; } @@ -43,7 +45,22 @@ export class Annotation extends React.Component<IProps> { */ @action onRemove = (e:any) => { - + let index:number = -1; + //finding the highlight in the highlight array + this.props.Highlights.forEach((e) => { + for (let i = 0; i < e.spans.length; i++){ + if (e.spans[i] == this.props.Span){ + index = this.props.Highlights.indexOf(e); + this.props.Highlights.splice(index, 1); + } + } + }) + + //removing from CurrAnno and Annotation array + this.props.Annotations.splice(index, 1); + this.props.CurrAnno.pop() + + //removing span from div if(this.props.Span.parentElement){ let nodesArray = this.props.Span.parentElement.childNodes; nodesArray.forEach((e) => { @@ -55,13 +72,12 @@ export class Annotation extends React.Component<IProps> { } }) e.remove(); - - - } } }) } + + } render() { @@ -75,7 +91,7 @@ export class Annotation extends React.Component<IProps> { transform: `translate(${this.props.X}px, ${this.props.Y}px)`, }}> - <div style = {{width:"200px", height:"50px"}}> + <div style = {{width:"200px", height:"50px", backgroundColor: "orange"}}> <button style = {{borderRadius: "25px", width:"25%", height:"100%"}} onClick = {this.onRemove} |
