Browse Source

Make links work in fullscreen - fix issue mentioned by @yurydelenik

Jonas 12 years ago
parent
commit
87017ec3cf
  1. 22
      web/viewer.js

22
web/viewer.js

@ -1106,8 +1106,10 @@ var PDFView = { @@ -1106,8 +1106,10 @@ var PDFView = {
if (pageNumber) {
this.page = pageNumber;
var currentPage = this.pages[pageNumber - 1];
if (!this.isFullscreen) { // Avoid breaking fullscreen mode.
currentPage.scrollIntoView(dest);
}
}
},
getDestinationHash: function pdfViewGetDestinationHash(dest) {
@ -3235,7 +3237,7 @@ window.addEventListener('DOMMouseScroll', function(evt) { @@ -3235,7 +3237,7 @@ window.addEventListener('DOMMouseScroll', function(evt) {
}
}, false);
window.addEventListener('mousemove', function keydown(evt) {
window.addEventListener('mousemove', function mousemove(evt) {
if (PDFView.isFullscreen) {
PDFView.showPresentationControls();
}
@ -3243,11 +3245,25 @@ window.addEventListener('mousemove', function keydown(evt) { @@ -3243,11 +3245,25 @@ window.addEventListener('mousemove', function keydown(evt) {
window.addEventListener('mousedown', function mousedown(evt) {
if (PDFView.isFullscreen && evt.button === 0) {
// Mouse click in fullmode advances a page
// Enable clicking of links in fullscreen mode.
// Note: Only links that point to the currently loaded PDF document works.
var targetHref = evt.target.href;
var internalLink = targetHref && (targetHref.replace(/#.*$/, '') ===
window.location.href.replace(/#.*$/, ''));
if (!internalLink) {
// Unless an internal link was clicked, advance a page in fullscreen mode.
evt.preventDefault();
PDFView.page++;
}
}
}, false);
window.addEventListener('click', function click(evt) {
if (PDFView.isFullscreen && evt.button === 0) {
// Necessary since preventDefault() in 'mousedown' won't stop
// the event propagation in all circumstances.
evt.preventDefault();
}
}, false);
window.addEventListener('keydown', function keydown(evt) {

Loading…
Cancel
Save