diff --git a/src/doc/DocAnnotator.js b/src/doc/DocAnnotator.js index 5bbe847eb..dd485f22a 100644 --- a/src/doc/DocAnnotator.js +++ b/src/doc/DocAnnotator.js @@ -655,11 +655,11 @@ class DocAnnotator extends Annotator { this.isCreatingHighlight = true; if (this.plainHighlightEnabled) { - this.modeControllers[TYPES.highlight].applyActionToThreads((thread) => thread.onMousedown()); + this.modeControllers[TYPES.highlight].destroyPendingThreads(); } if (this.commentHighlightEnabled) { - this.modeControllers[TYPES.highlight_comment].applyActionToThreads((thread) => thread.onMousedown()); + this.modeControllers[TYPES.highlight_comment].destroyPendingThreads(); } }; diff --git a/src/doc/DocHighlightThread.js b/src/doc/DocHighlightThread.js index 66ed8278b..9bcec84c8 100644 --- a/src/doc/DocHighlightThread.js +++ b/src/doc/DocHighlightThread.js @@ -129,18 +129,6 @@ class DocHighlightThread extends AnnotationThread { } }; - /** - * Mousedown handler for thread. Deletes this thread if it is still pending. - * - * @return {void} - */ - onMousedown() { - // Destroy pending highlights on mousedown - if (this.state === STATES.pending) { - this.destroy(); - } - } - /** * Click handler for thread. If click is inside this highlight, set the * state to be active, and return true. If not, hide the delete highlight diff --git a/src/doc/__tests__/DocAnnotator-test.js b/src/doc/__tests__/DocAnnotator-test.js index 3f356d9a2..7ec1f2adc 100644 --- a/src/doc/__tests__/DocAnnotator-test.js +++ b/src/doc/__tests__/DocAnnotator-test.js @@ -737,13 +737,13 @@ describe('doc/DocAnnotator', () => { it('should do nothing if highlights are disabled', () => { annotator.highlightMousedownHandler({ clientX: 1, clientY: 1 }); - expect(thread.onMousedown).not.toBeCalled(); + expect(controller.destroyPendingThreads).not.toBeCalled(); }); it('should get highlights on page and call their onMouse down method', () => { annotator.plainHighlightEnabled = true; annotator.highlightMousedownHandler({ clientX: 1, clientY: 1 }); - expect(controller.applyActionToThreads).toBeCalled(); + expect(controller.destroyPendingThreads).toBeCalled(); }); }); diff --git a/src/doc/__tests__/DocHighlightThread-test.js b/src/doc/__tests__/DocHighlightThread-test.js index 5e1cf2bae..5dc197267 100644 --- a/src/doc/__tests__/DocHighlightThread-test.js +++ b/src/doc/__tests__/DocHighlightThread-test.js @@ -85,15 +85,6 @@ describe('doc/DocHighlightThread', () => { }); }); - describe('onMousedown()', () => { - it('should destroy the thread when annotation is in pending state', () => { - thread.state = STATES.pending; - thread.destroy = jest.fn(); - thread.onMousedown(); - expect(thread.destroy).toBeCalled(); - }); - }); - describe('onClick()', () => { it('should set annotation to inactive if event has already been consumed', () => { thread.state = STATES.active;