Skip to content
Snippets Groups Projects
Commit 1077ed99 authored by john's avatar john
Browse files

handle deleting with non-collapsed selections on an existing add track annotation

parent 958f9409
No related branches found
No related tags found
No related merge requests found
...@@ -161,10 +161,39 @@ class TrackChangesProvider { ...@@ -161,10 +161,39 @@ class TrackChangesProvider {
} }
} }
} else { } else {
selection = this.getSelection() const notOnTrack = this.isNotOnTrackAnnotation()
this.createDeleteAnnotation(selection)
this.moveCursorTo(direction.cursorTo) if (notOnTrack) {
return selection = this.getSelection()
this.createDeleteAnnotation(selection)
this.moveCursorTo(direction.cursorTo)
return
}
const onAdd = this.isOnAnnotation('add')
if (onAdd) {
const annotation = this.getAnnotationByStatus('add')
const withinAnnotation = this.isSelectionContainedWithin(annotation)
if (withinAnnotation) {
const point = annotation[direction.cursorTo + 'Offset']
this.moveCursorTo(point)
return
}
const annotationContainedInSelection = this.isAnnotationContainedWithinSelection(annotation)
if (annotationContainedInSelection) {
selection = this.getSelection()
this.createDeleteAnnotation(selection)
return
}
selection = this.getSelection()
this.createDeleteAnnotation(selection)
this.separateAnnotations()
return
}
} }
} }
...@@ -460,6 +489,13 @@ class TrackChangesProvider { ...@@ -460,6 +489,13 @@ class TrackChangesProvider {
return selection return selection
} }
isAnnotationContainedWithinSelection (annotation) {
const selection = this.getSelection()
const annotationSelection = annotation.getSelection()
return selection.contains(annotationSelection)
}
isSelectionCollapsed () { isSelectionCollapsed () {
const selection = this.getSelection() const selection = this.getSelection()
const isCollapsed = selection.isCollapsed() const isCollapsed = selection.isCollapsed()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment