diff --git a/src/AnnotationThread.js b/src/AnnotationThread.js index a0bd235fc..b274bcec2 100644 --- a/src/AnnotationThread.js +++ b/src/AnnotationThread.js @@ -7,7 +7,6 @@ import AnnotationAPI from './api/AnnotationAPI'; import * as util from './util'; import { ICON_PLACED_ANNOTATION } from './icons/icons'; import { - SELECTOR_ANNOTATION_POPOVER, CLASS_ANNOTATION_POINT_MARKER, CLASS_FLIPPED_POPOVER, DATA_TYPE_ANNOTATION_INDICATOR, @@ -204,8 +203,7 @@ class AnnotationThread extends EventEmitter { popoverLayer ); - const popoverEl = popoverLayer.querySelector(SELECTOR_ANNOTATION_POPOVER); - popoverEl.scrollIntoView(); + this.scrollIntoView(); } /** diff --git a/src/doc/DocAnnotator.js b/src/doc/DocAnnotator.js index 9398936ed..47b9feadc 100644 --- a/src/doc/DocAnnotator.js +++ b/src/doc/DocAnnotator.js @@ -836,13 +836,18 @@ class DocAnnotator extends Annotator { return false; } + /** @inheritdoc */ + toggleAnnotationMode(mode: AnnotationType) { + this.resetAnnotationUI(); + super.toggleAnnotationMode(mode); + } + /** @inheritdoc */ hideAnnotations(event: ?Event) { if (event && util.isInDialog(event, this.container)) { return; } - this.resetHighlightSelection(event); super.hideAnnotations(); } diff --git a/src/doc/DocDrawingThread.js b/src/doc/DocDrawingThread.js index 7badbe272..8ce8ec125 100644 --- a/src/doc/DocDrawingThread.js +++ b/src/doc/DocDrawingThread.js @@ -181,6 +181,13 @@ class DocDrawingThread extends DrawingThread { this.draw(context, false); } + /** + * Do nothing for drawing annotations + * + * @return {void} + */ + scrollIntoView() {} + /** @inheritdoc */ hide() { this.clearBoundary(); diff --git a/src/doc/DocHighlightThread.js b/src/doc/DocHighlightThread.js index bc587b535..c01d56b35 100644 --- a/src/doc/DocHighlightThread.js +++ b/src/doc/DocHighlightThread.js @@ -275,7 +275,7 @@ class DocHighlightThread extends AnnotationThread { const [yPos] = docUtil.getLowerRightCornerOfLastQuadPoint(this.location.quadPoints); // Adjust scroll to highlight position - this.adjustScroll(this.annotatedElement.scrollTop + yPos); + this.centerAnnotation(this.annotatedElement.scrollTop + yPos); } /**