[Pkg-javascript-commits] [pdf.js] 38/414: Do not modify `data.rect` in `AnnotationElement_createContainer`, since that will corrupt the annotation position on subsequent calls

David Prévot taffit at moszumanska.debian.org
Tue Jun 28 17:12:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 3c7088dc44c504cad487631fd96ba9cc4fa4e23e
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sun Dec 27 12:46:20 2015 +0100

    Do not modify `data.rect` in `AnnotationElement_createContainer`, since that will corrupt the annotation position on subsequent calls
    
    Fixes 6804; this regressed in PR 6714.
---
 src/display/annotation_layer.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js
index 9a1545d..17cbb2a 100644
--- a/src/display/annotation_layer.js
+++ b/src/display/annotation_layer.js
@@ -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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list