From 1a446e8337644918e8b2f134730ac28899fdb29a Mon Sep 17 00:00:00 2001 From: Sumedha Pramod Date: Wed, 16 Jan 2019 16:47:47 -0800 Subject: [PATCH] Fix: Double click to highlight on Edge --- src/AnnotationThread.js | 3 +-- src/doc/DocAnnotator.js | 7 ++++++- src/doc/DocDrawingThread.js | 7 +++++++ src/doc/DocHighlightThread.js | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/AnnotationThread.js b/src/AnnotationThread.js index a0bd235fc..6fb2d60b6 100644 --- a/src/AnnotationThread.js +++ b/src/AnnotationThread.js @@ -204,8 +204,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); } /**