Fix a warning when the destination link point to nothing

This commit is contained in:
Vivien Nicolas 2011-08-31 14:17:57 +02:00
parent 25d4fb0d81
commit 763bd7059a
2 changed files with 5 additions and 5 deletions

View File

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

View 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);
}
}