Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Dialog not showing when creating points #295

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/doc/DocHighlightThread.js
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
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
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