From 2531515f15b455b4f0899a48c542e30ce6ff95eb Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 24 Aug 2012 10:12:03 -0500 Subject: [PATCH 1/3] Replaces scrollIntoView --- web/viewer.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/web/viewer.js b/web/viewer.js index f93c5247b..213ae8cec 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -33,6 +33,17 @@ function getFileName(url) { return url.substring(url.lastIndexOf('/', end) + 1, end); } +function scrollIntoView(element, spot) { + var parent = element.offsetParent, offsetY = element.offsetTop; + while (parent.clientHeight == parent.scrollHeight) { + offsetY += parent.offsetTop; + parent = parent.offsetParent; + } + if (spot) + offsetY += spot.top; + parent.scrollTop = offsetY; +} + var Cache = function cacheCache(size) { var data = []; this.push = function cachePush(view) { @@ -1309,7 +1320,7 @@ var PageView = function pageView(container, pdfPage, id, scale, this.scrollIntoView = function pageViewScrollIntoView(dest) { if (!dest) { - div.scrollIntoView(true); + scrollIntoView(div); return; } @@ -1368,16 +1379,7 @@ var PageView = function pageView(container, pdfPage, id, scale, var width = Math.abs(boundingRect[0][0] - boundingRect[1][0]); var height = Math.abs(boundingRect[0][1] - boundingRect[1][1]); - // using temporary div to scroll it into view - var tempDiv = document.createElement('div'); - tempDiv.style.position = 'absolute'; - tempDiv.style.left = Math.floor(x) + 'px'; - tempDiv.style.top = Math.floor(y) + 'px'; - tempDiv.style.width = Math.ceil(width) + 'px'; - tempDiv.style.height = Math.ceil(height) + 'px'; - div.appendChild(tempDiv); - tempDiv.scrollIntoView(true); - div.removeChild(tempDiv); + scrollIntoView(div, {left: x, top: y, width: width, height: height}); }, 0); }; @@ -2078,7 +2080,7 @@ window.addEventListener('pagechange', function pagechange(evt) { var last = numVisibleThumbs > 1 ? visibleThumbs.last.id : first; if (page <= first || page >= last) - thumbnail.scrollIntoView(); + scrollIntoView(thumbnail); } } From 1cbbb37fbc41a8044feeaea5c1cf7a68fc5691b6 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 27 Aug 2012 10:57:40 -0500 Subject: [PATCH 2/3] Making webkit fullscreen work as for moz --- web/viewer.css | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/web/viewer.css b/web/viewer.css index 95691e818..439ec8ca3 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -29,28 +29,13 @@ select { #viewerContainer:-webkit-full-screen { top: 0px; - padding-top: 6px; - padding-bottom: 24px; background-color: #404040; background-image: url(images/texture.png); width: 100%; height: 100%; - overflow: auto; -} - -:-webkit-full-screen #viewer { - margin: 0pt; - padding: 0pt; - height: 100%; - width: 100%; overflow: hidden; } -:-webkit-full-screen .page { - margin: 0px auto; - margin-bottom: 10px; -} - #viewerContainer:-moz-full-screen { background-color: #404040; background-image: url(images/texture.png); @@ -59,6 +44,10 @@ select { overflow: hidden; } +:-webkit-full-screen .page:last-child { + margin-bottom: 40px; +} + :-moz-full-screen .page:last-child { margin-bottom: 40px; } From 72bb0f5a4533d2344eb7117e8cb4379a5aae4aed Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 27 Aug 2012 12:46:26 -0500 Subject: [PATCH 3/3] Add top padding for full screen mode --- web/viewer.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/viewer.css b/web/viewer.css index 439ec8ca3..97e6c742e 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -29,6 +29,7 @@ select { #viewerContainer:-webkit-full-screen { top: 0px; + border-top: 5px solid transparent; background-color: #404040; background-image: url(images/texture.png); width: 100%; @@ -37,6 +38,8 @@ select { } #viewerContainer:-moz-full-screen { + top: 0px; + border-top: 5px solid transparent; background-color: #404040; background-image: url(images/texture.png); width: 100%;