[Pkg-javascript-commits] [pdf.js] 14/174: Tweak `PDFPageView` to reflect that `this.annotationLayer` is an `AnnotationsLayerBuilder` instance, instead of a DOM element (PR 5552 follow-up)

David Prévot taffit at moszumanska.debian.org
Thu Nov 19 18:44:59 UTC 2015


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

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

commit c7fd7f898f60a616660a355d805bbcb56d9940bf
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Wed Sep 23 19:34:11 2015 +0200

    Tweak `PDFPageView` to reflect that `this.annotationLayer` is an `AnnotationsLayerBuilder` instance, instead of a DOM element (PR 5552 follow-up)
    
    In PR 5552, specifically commit https://github.com/mozilla/pdf.js/commit/9f384bbb41f780b258d832d1c7170b570aedac95, the meaning of `this.annotationLayer` changed in `PDFPageView`. Previously it referred directly to a DOM element, but now it's instead an instance of `AnnotationsLayerBuilder`.
    This patch tweaks things so that we won't try to hide a non-existent `annotationLayer` div in `PDFPageView_reset`, and also so that we don't attempt to insert empty (`null`) DOM elements in `PDFPageView_draw`.
---
 web/pdf_page_view.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js
index fc68ee0..83b312a 100644
--- a/web/pdf_page_view.js
+++ b/web/pdf_page_view.js
@@ -129,12 +129,10 @@ var PDFPageView = (function PDFPageViewClosure() {
       }
       div.removeAttribute('data-loaded');
 
-      if (keepAnnotations) {
-        if (this.annotationLayer) {
-          // Hide annotationLayer until all elements are resized
-          // so they are not displayed on the already-resized page
-          this.annotationLayer.hide();
-        }
+      if (currentAnnotationNode) {
+        // Hide annotationLayer until all elements are resized
+        // so they are not displayed on the already-resized page
+        this.annotationLayer.hide();
       } else {
         this.annotationLayer = null;
       }
@@ -303,7 +301,7 @@ var PDFPageView = (function PDFPageViewClosure() {
       var canvas = document.createElement('canvas');
       canvas.id = 'page' + this.id;
       canvasWrapper.appendChild(canvas);
-      if (this.annotationLayer) {
+      if (this.annotationLayer && this.annotationLayer.div) {
         // annotationLayer needs to stay on top
         div.insertBefore(canvasWrapper, this.annotationLayer.div);
       } else {
@@ -350,7 +348,7 @@ var PDFPageView = (function PDFPageViewClosure() {
         textLayerDiv.className = 'textLayer';
         textLayerDiv.style.width = canvas.style.width;
         textLayerDiv.style.height = canvas.style.height;
-        if (this.annotationLayer) {
+        if (this.annotationLayer && this.annotationLayer.div) {
           // annotationLayer needs to stay on top
           div.insertBefore(textLayerDiv, this.annotationLayer.div);
         } else {

-- 
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