Browse Source

Fix a warning when the destination link point to nothing

Vivien Nicolas 14 years ago
parent
commit
763bd7059a
  1. 1
      fonts.js
  2. 9
      web/viewer.js

1
fonts.js

@ -80,6 +80,7 @@ var FontMeasure = (function FontMeasure() {
size *= kScalePrecision; size *= kScalePrecision;
var rule = italic + ' ' + bold + ' ' + size + 'px "' + name + '"'; var rule = italic + ' ' + bold + ' ' + size + 'px "' + name + '"';
ctx.font = rule; ctx.font = rule;
current = font;
}, },
measureText: function fonts_measureText(text) { measureText: function fonts_measureText(text) {
var width; var width;

9
web/viewer.js

@ -217,11 +217,10 @@ var PageView = function(container, content, id, width, height,
function setupLinks(canvas, content, scale) { function setupLinks(canvas, content, scale) {
function bindLink(link, dest) { function bindLink(link, dest) {
if (dest) { link.onclick = function() {
link.onclick = function() { if (dest)
PDFView.navigateTo(dest); PDFView.navigateTo(dest);
return false; return false;
};
} }
} }
var links = content.getLinks(); 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.width = Math.ceil(links[i].width * scale) + 'px';
link.style.height = Math.ceil(links[i].height * scale) + 'px'; link.style.height = Math.ceil(links[i].height * scale) + 'px';
link.href = links[i].url || ''; link.href = links[i].url || '';
bindLink(link, links[i].dest); bindLink(link, ('dest' in links[i]) ? links[i].dest : null);
div.appendChild(link); div.appendChild(link);
} }
} }

Loading…
Cancel
Save