fix annotation selection

This commit is contained in:
j 2019-01-22 19:36:48 +05:30
parent 2e412933a7
commit 1130f3ff00
1 changed files with 3 additions and 2 deletions

View File

@ -53,10 +53,10 @@ function renderAnnotation(annotation) {
if (!page.canvas) {
setTimeout(function() {
renderAnnotation(annotation)
}, 50)
}, 10)
return
}
var pageElement = page.canvas.parentElement;
var pageElement = page.canvas.parentElement.parentElement;
var viewport = page.viewport;
annotation.coords.forEach(function (rect) {
var bounds = viewport.convertToViewportRectangle(rect);
@ -68,6 +68,7 @@ function renderAnnotation(annotation) {
el.setAttribute('style', 'position: absolute; background-color: yellow;opacity:0.3;' +
'left:' + Math.min(bounds[0], bounds[2]) + 'px; top:' + Math.min(bounds[1], bounds[3]) + 'px;' +
'width:' + Math.abs(bounds[0] - bounds[2]) + 'px; height:' + Math.abs(bounds[1] - bounds[3]) + 'px;');
el.addEventListener('click', function() {
if (el.classList.contains('selected')) {
deselectAnnotation(annotation.id)