fix annotation selection
This commit is contained in:
parent
2e412933a7
commit
1130f3ff00
1 changed files with 3 additions and 2 deletions
|
@ -53,10 +53,10 @@ function renderAnnotation(annotation) {
|
||||||
if (!page.canvas) {
|
if (!page.canvas) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
renderAnnotation(annotation)
|
renderAnnotation(annotation)
|
||||||
}, 50)
|
}, 10)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var pageElement = page.canvas.parentElement;
|
var pageElement = page.canvas.parentElement.parentElement;
|
||||||
var viewport = page.viewport;
|
var viewport = page.viewport;
|
||||||
annotation.coords.forEach(function (rect) {
|
annotation.coords.forEach(function (rect) {
|
||||||
var bounds = viewport.convertToViewportRectangle(rect);
|
var bounds = viewport.convertToViewportRectangle(rect);
|
||||||
|
@ -68,6 +68,7 @@ function renderAnnotation(annotation) {
|
||||||
el.setAttribute('style', 'position: absolute; background-color: yellow;opacity:0.3;' +
|
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;' +
|
'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;');
|
'width:' + Math.abs(bounds[0] - bounds[2]) + 'px; height:' + Math.abs(bounds[1] - bounds[3]) + 'px;');
|
||||||
|
|
||||||
el.addEventListener('click', function() {
|
el.addEventListener('click', function() {
|
||||||
if (el.classList.contains('selected')) {
|
if (el.classList.contains('selected')) {
|
||||||
deselectAnnotation(annotation.id)
|
deselectAnnotation(annotation.id)
|
||||||
|
|
Loading…
Reference in a new issue