scroll select annotation into view
This commit is contained in:
parent
0bfbebb21d
commit
d97d396ef3
1 changed files with 8 additions and 1 deletions
|
@ -11,14 +11,21 @@ Ox.load({
|
|||
console.log('got', event, 'data', data)
|
||||
if (event == 'selectAnnotation') {
|
||||
var annotation = annotations.filter(function(a) { return a.id == data.id })[0]
|
||||
var delay = 0
|
||||
if (
|
||||
annotation &&
|
||||
annotation.page &&
|
||||
PDFViewerApplication.pdfViewer.currentPageNumber != annotation.page
|
||||
) {
|
||||
//FIXME: scroll into view
|
||||
PDFViewerApplication.pdfViewer.currentPageNumber = annotation.page;
|
||||
delay = 250
|
||||
}
|
||||
setTimeout(function() {
|
||||
var el = document.querySelector('.a' + annotation.id);
|
||||
if (el) {
|
||||
document.querySelector('#viewerContainer').scrollTop = el.offsetTop + el.parentElement.offsetTop - 64;
|
||||
}
|
||||
}, delay)
|
||||
selectAnnotation(data.id)
|
||||
} else if (event == 'addAnnotations') {
|
||||
data.annotations.forEach(function(annotation) {
|
||||
|
|
Loading…
Reference in a new issue