Skip to content

Commit

Permalink
Fix text dragging clearing text selection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Oct 25, 2023
1 parent 2baa95e commit d3b0412
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pdf/pdf-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
}

Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit d3b0412

Please sign in to comment.