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 => {
|
||||
// Delete connections
|
||||
const connections = this.relationsLayer.getConnectionsFor(annotation);
|
||||
connections.forEach(c => c.destroy());
|
||||
this.relationsLayer.destroyConnectionsFor(annotation);
|
||||
|
||||
this.clearState();
|
||||
this.selectionHandler.clearSelection();
|
||||
|
|
|
@ -104,6 +104,12 @@ export default class RelationsLayer extends EventEmitter {
|
|||
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 = () =>
|
||||
this.svg.style.display = 'inital';
|
||||
|
||||
|
|
Loading…
Reference in New Issue