Merge pull request #6805 from Snuffleupagus/issue-6804

Do not modify `data.rect` in `AnnotationElement_createContainer`, since that will corrupt the annotation position on subsequent calls
This commit is contained in:
Tim van der Meij 2015-12-27 14:36:45 +01:00
commit ad4354c0bd

View File

@ -109,7 +109,9 @@ var AnnotationElement = (function AnnotationElementClosure() {
container.setAttribute('data-annotation-id', data.id);
data.rect = Util.normalizeRect([
// Do *not* modify `data.rect`, since that will corrupt the annotation
// position on subsequent calls to `_createContainer` (see issue 6804).
var rect = Util.normalizeRect([
data.rect[0],
page.view[3] - data.rect[1] + page.view[1],
data.rect[2],
@ -119,7 +121,7 @@ var AnnotationElement = (function AnnotationElementClosure() {
CustomStyle.setProp('transform', container,
'matrix(' + viewport.transform.join(',') + ')');
CustomStyle.setProp('transformOrigin', container,
-data.rect[0] + 'px ' + -data.rect[1] + 'px');
-rect[0] + 'px ' + -rect[1] + 'px');
if (data.borderStyle.width > 0) {
container.style.borderWidth = data.borderStyle.width + 'px';
@ -174,8 +176,8 @@ var AnnotationElement = (function AnnotationElementClosure() {
}
}
container.style.left = data.rect[0] + 'px';
container.style.top = data.rect[1] + 'px';
container.style.left = rect[0] + 'px';
container.style.top = rect[1] + 'px';
container.style.width = width + 'px';
container.style.height = height + 'px';
@ -461,7 +463,7 @@ var PopupAnnotationElement = (function PopupAnnotationElementClosure() {
/**
* @class
* @alias PopupElement
* @alias PopupElement
*/
var PopupElement = (function PopupElementClosure() {
var BACKGROUND_ENLIGHT = 0.7;