Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/common/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2116,8 +2116,15 @@ class Reader {
let currentAnnotation = this._annotationManager._getAnnotationByID(id);
let selectedAnnotations = this._annotationManager._annotations.filter(x => selectedIDs.includes(x.id));
let allAnnotations = this._annotationManager._annotations;
// Get target rect from preview component in the sidebar or a view popup
let labelNode = document.querySelector(`[data-sidebar-annotation-id="${id}"] header .label, .view-popup header .label`);
// Get target rect from the currently visible source: sidebar annotation item
// (when annotations sidebar is active) or the view annotation popup label.
let labelNode;
if (this._state.sidebarOpen && this._state.sidebarView === 'annotations') {
labelNode = document.querySelector(`[data-sidebar-annotation-id="${id}"] header .label`);
}
else {
labelNode = document.querySelector('.annotation-popup header .label');
}
let { left, top, right, bottom } = labelNode.getBoundingClientRect();
let rect = [left, top, right, bottom];
this._updateState({ labelPopup: { currentAnnotation, selectedAnnotations, allAnnotations, rect, selectedIDs, pageLabels } });
Expand Down
Loading