Skip to content

Commit

Permalink
Fix: Dialog not showing when creating points (#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinHoldstock authored Nov 23, 2018
1 parent d26ca1d commit c0ee86f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/doc/DocHighlightThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class DocHighlightThread extends AnnotationThread {
// Position it below lower right corner or center of the highlight - we need
// to reposition every time since the DOM could have changed from
// zooming
const pageEl = this.popoverParent;
const pageEl = this.getPopoverParent();
const pageDimensions = pageEl.getBoundingClientRect();
const pageHeight = pageDimensions.height - PAGE_PADDING_TOP - PAGE_PADDING_BOTTOM;
const [browserX, browserY] = docUtil.getScaledPDFCoordinates(
Expand Down
2 changes: 1 addition & 1 deletion src/doc/DocPointThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DocPointThread extends AnnotationThread {
return;
}

const pageEl = this.popoverParent;
const pageEl = this.getPopoverParent();
const popoverEl = findElement(
this.annotatedElement,
SELECTOR_CLASS_ANNOTATION_POPOVER,
Expand Down
7 changes: 4 additions & 3 deletions src/image/ImagePointThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class ImagePointThread extends AnnotationThread {
const threadIconLeftX = this.element.offsetLeft + POINT_ANNOTATION_ICON_WIDTH / 2;
let dialogLeftX = threadIconLeftX - dialogWidth / 2;

const isUpperHalf = isInUpperHalf(this.element, this.popoverParent);
const popoverParentEl = this.getPopoverParent();
const isUpperHalf = isInUpperHalf(this.element, popoverParentEl);
const flippedPopoverOffset = isUpperHalf
? 0
: popoverEl.getBoundingClientRect().height +
Expand All @@ -71,8 +72,8 @@ class ImagePointThread extends AnnotationThread {
// just center the dialog and cause scrolling since there is nothing
// else we can do
const pageWidth =
this.popoverParent.clientWidth > this.annotatedElement.clientWidth
? this.popoverParent.clientWidth
popoverParentEl.clientWidth > this.annotatedElement.clientWidth
? popoverParentEl.clientWidth
: this.annotatedElement.clientWidth;
dialogLeftX = repositionCaret(popoverEl, dialogLeftX, dialogWidth, threadIconLeftX, pageWidth, !isUpperHalf);

Expand Down

0 comments on commit c0ee86f

Please sign in to comment.