Skip to content

Commit

Permalink
Allow starting from end when annotating with touch
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Sep 14, 2023
1 parent 005a88e commit 861dc41
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dom/common/dom-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,10 @@ abstract class DOMView<State extends DOMViewState, Data> {
let range = this._iframeDocument.createRange();
range.setStart(this._touchAnnotationStartPosition.offsetNode, this._touchAnnotationStartPosition.offset);
range.setEnd(endPos.offsetNode, endPos.offset);
if (range.collapsed) {
range.setStart(endPos.offsetNode, endPos.offset);
range.setEnd(this._touchAnnotationStartPosition.offsetNode, this._touchAnnotationStartPosition.offset);
}
let annotation = this._getAnnotationFromRange(range, this._tool.type, this._tool.color);
if (annotation) {
this._previewAnnotation = annotation;
Expand Down

0 comments on commit 861dc41

Please sign in to comment.