diff --git a/src/Annotator.scss b/src/Annotator.scss index 100f37cbe..4ad93135c 100644 --- a/src/Annotator.scss +++ b/src/Annotator.scss @@ -479,10 +479,6 @@ $tablet: 'max-width: 768px'; white-space: normal; } -.bp-annotation-drawing-dialog { - padding: 0; -} - .bp-use-default-cursor { cursor: default; diff --git a/src/BoxAnnotations.js b/src/BoxAnnotations.js index f04381bdf..9eacd1914 100644 --- a/src/BoxAnnotations.js +++ b/src/BoxAnnotations.js @@ -119,6 +119,7 @@ class BoxAnnotations { } const enabledTypes = this.viewerConfig.enabledTypes || [...annotatorConfig.DEFAULT_TYPES]; + enabledTypes.push('draw'); // Keeping disabledTypes for backwards compatibility const disabledTypes = this.viewerConfig.disabledTypes || []; diff --git a/src/doc/DocAnnotator.js b/src/doc/DocAnnotator.js index b8918aabf..4db720e0d 100644 --- a/src/doc/DocAnnotator.js +++ b/src/doc/DocAnnotator.js @@ -425,39 +425,35 @@ class DocAnnotator extends Annotator { bindDOMListeners() { super.bindDOMListeners(); - if (this.plainHighlightEnabled || this.commentHighlightEnabled) { - this.annotatedElement.addEventListener('mouseup', this.highlightMouseupHandler); + if (this.hasTouch && this.isMobile) { + if (this.drawEnabled) { + this.annotatedElement.addEventListener('touchstart', this.drawingSelectionHandler); + } + } else { + if (this.drawEnabled) { + this.annotatedElement.addEventListener('click', this.drawingSelectionHandler); + } - if (!this.hasTouch || !this.isMobile) { + // Highlight listeners + if (this.plainHighlightEnabled || this.commentHighlightEnabled) { + this.annotatedElement.addEventListener('mouseup', this.highlightMouseupHandler); this.annotatedElement.addEventListener('mousemove', this.getHighlightMouseMoveHandler()); } } // Prevent all forms of highlight annotations if annotating (or plain AND comment highlights) is disabled - if (!this.permissions.canAnnotate) { + if (!this.permissions.canAnnotate || !this.plainHighlightEnabled || !!this.commentHighlightEnabled) { return; } if (this.hasTouch && this.isMobile) { - if (this.drawEnabled) { - this.annotatedElement.addEventListener('touchstart', this.drawingSelectionHandler); - } - // Highlight listeners - if (this.plainHighlightEnabled || this.commentHighlightEnabled) { - document.addEventListener('selectionchange', this.onSelectionChange); - } + document.addEventListener('selectionchange', this.onSelectionChange); } else { - if (this.drawEnabled) { - this.annotatedElement.addEventListener('click', this.drawingSelectionHandler); - } - // Highlight listeners - if (this.plainHighlightEnabled || this.commentHighlightEnabled) { - this.annotatedElement.addEventListener('dblclick', this.highlightMouseupHandler); - this.annotatedElement.addEventListener('mousedown', this.highlightMousedownHandler); - this.annotatedElement.addEventListener('contextmenu', this.highlightMousedownHandler); - } + this.annotatedElement.addEventListener('dblclick', this.highlightMouseupHandler); + this.annotatedElement.addEventListener('mousedown', this.highlightMousedownHandler); + this.annotatedElement.addEventListener('contextmenu', this.highlightMousedownHandler); } }