diff --git a/src/pdf/pdf-view.js b/src/pdf/pdf-view.js index 97406709..012196e3 100644 --- a/src/pdf/pdf-view.js +++ b/src/pdf/pdf-view.js @@ -1249,7 +1249,7 @@ class PDFView { let r = position.rects[0]; let br = getPositionBoundingRect(annotation.position); let action = { type: 'drag', annotation, x: r[0] - br[0], y: r[1] - br[1], selection: true }; - return { action, selectAnnotations: [] }; + return { action, selectAnnotations: null }; } } @@ -2076,6 +2076,10 @@ class PDFView { this._openAnnotationPopup(); } } + // This is necessary to clear text selection if the drag action hasn't been triggered + if (action.selection && action.type === 'drag' && !action.triggered) { + this._onSelectAnnotations([], event); + } if (action.type === 'selectText') { // TODO: Handle triple click as well. Likely there should be a delay when action.mode is 'word' if (['highlight', 'underline'].includes(this._tool.type)) {