Bugfix: connections now properly removed when deleting attached annotation
This commit is contained in:
parent
cc2421526e
commit
002af61add
|
@ -88,8 +88,7 @@ export default class TextAnnotator extends Component {
|
||||||
|
|
||||||
onDeleteAnnotation = annotation => {
|
onDeleteAnnotation = annotation => {
|
||||||
// Delete connections
|
// Delete connections
|
||||||
const connections = this.relationsLayer.getConnectionsFor(annotation);
|
this.relationsLayer.destroyConnectionsFor(annotation);
|
||||||
connections.forEach(c => c.destroy());
|
|
||||||
|
|
||||||
this.clearState();
|
this.clearState();
|
||||||
this.selectionHandler.clearSelection();
|
this.selectionHandler.clearSelection();
|
||||||
|
|
|
@ -104,6 +104,12 @@ export default class RelationsLayer extends EventEmitter {
|
||||||
c.startAnnotation.isEqual(annotation) || c.endAnnotation.isEqual(annotation));
|
c.startAnnotation.isEqual(annotation) || c.endAnnotation.isEqual(annotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyConnectionsFor = annotation => {
|
||||||
|
const connections = this.getConnectionsFor(annotation);
|
||||||
|
connections.forEach(c => c.destroy());
|
||||||
|
this.connections = this.connections.filter(c => !connections.includes(c));
|
||||||
|
}
|
||||||
|
|
||||||
show = () =>
|
show = () =>
|
||||||
this.svg.style.display = 'inital';
|
this.svg.style.display = 'inital';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue