Fix a warning when the destination link point to nothing
This commit is contained in:
parent
25d4fb0d81
commit
763bd7059a
1
fonts.js
1
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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user