]> git.parisson.com Git - pdf.js.git/commitdiff
Fix a warning when the destination link point to nothing
authorVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 12:17:57 +0000 (14:17 +0200)
committerVivien Nicolas <21@vingtetun.org>
Wed, 31 Aug 2011 12:17:57 +0000 (14:17 +0200)
fonts.js
web/viewer.js

index 24fd35d61bb97937796281e211b8491f36008e0c..02aa52601c9a96a2199c1a960b97a0940835a868 100755 (executable)
--- a/fonts.js
+++ b/fonts.js
@@ -80,6 +80,7 @@ var FontMeasure = (function FontMeasure() {
       size *= kScalePrecision;
       var rule = italic + ' ' + bold + ' ' + size + 'px "' + name + '"';
       ctx.font = rule;
+      current = font;
     },
     measureText: function fonts_measureText(text) {
       var width;
index 1e016e6e94633cec3ade303f32842910c69a313f..d57e47045ec4b65f5d3c2537d4072b02a5d1199f 100644 (file)
@@ -217,11 +217,10 @@ var PageView = function(container, content, id, width, height,
 
   function setupLinks(canvas, content, scale) {
     function bindLink(link, dest) {
-      if (dest) {
-        link.onclick = function() {
+      link.onclick = function() {
+        if (dest)
           PDFView.navigateTo(dest);
-          return false;
-        };
+        return false;
       }
     }
     var links = content.getLinks();
@@ -232,7 +231,7 @@ var PageView = function(container, content, id, width, height,
       link.style.width = Math.ceil(links[i].width * scale) + 'px';
       link.style.height = Math.ceil(links[i].height * scale) + 'px';
       link.href = links[i].url || '';
-      bindLink(link, links[i].dest);
+      bindLink(link, ('dest' in links[i]) ? links[i].dest : null);
       div.appendChild(link);
     }
   }