[Pkg-javascript-commits] [pdf.js] 07/119: Add a |PDFViewer| option to remove the border shadow around pages (issue 5559)
David Prévot
taffit at moszumanska.debian.org
Wed May 13 21:27:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 4a3b0d9c64b3c5955567066bb812e90c5713391b
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Wed Mar 11 20:36:01 2015 +0100
Add a |PDFViewer| option to remove the border shadow around pages (issue 5559)
---
web/pdf_viewer.css | 5 +++++
web/pdf_viewer.js | 20 ++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/web/pdf_viewer.css b/web/pdf_viewer.css
index e97fbe0..d1e59ab 100644
--- a/web/pdf_viewer.css
+++ b/web/pdf_viewer.css
@@ -31,6 +31,11 @@
background-color: white;
}
+.pdfViewer.removePageBorders .page {
+ margin: 0px auto 10px auto;
+ border: none;
+}
+
.pdfViewer .page canvas {
margin: 0;
display: block;
diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js
index ea70979..9cee8bf 100644
--- a/web/pdf_viewer.js
+++ b/web/pdf_viewer.js
@@ -44,6 +44,8 @@ var DEFAULT_CACHE_SIZE = 10;
* @property {IPDFLinkService} linkService - The navigation/linking service.
* @property {PDFRenderingQueue} renderingQueue - (optional) The rendering
* queue object.
+ * @property {boolean} removePageBorders - (optional) Removes the border shadow
+ * around the pages. The default is false.
*/
/**
@@ -80,6 +82,7 @@ var PDFViewer = (function pdfViewer() {
this.container = options.container;
this.viewer = options.viewer || options.container.firstElementChild;
this.linkService = options.linkService || new SimpleLinkService(this);
+ this.removePageBorders = options.removePageBorders || false;
this.defaultRenderingQueue = !options.renderingQueue;
if (this.defaultRenderingQueue) {
@@ -94,6 +97,10 @@ var PDFViewer = (function pdfViewer() {
this.updateInProgress = false;
this.presentationModeState = PresentationModeState.UNKNOWN;
this._resetView();
+
+ if (this.removePageBorders) {
+ this.viewer.classList.add('removePageBorders');
+ }
}
PDFViewer.prototype = /** @lends PDFViewer.prototype */{
@@ -397,8 +404,10 @@ var PDFViewer = (function pdfViewer() {
}
var inPresentationMode =
this.presentationModeState === PresentationModeState.FULLSCREEN;
- var hPadding = inPresentationMode ? 0 : SCROLLBAR_PADDING;
- var vPadding = inPresentationMode ? 0 : VERTICAL_PADDING;
+ var hPadding = (inPresentationMode || this.removePageBorders) ?
+ 0 : SCROLLBAR_PADDING;
+ var vPadding = (inPresentationMode || this.removePageBorders) ?
+ 0 : VERTICAL_PADDING;
var pageWidthScale = (this.container.clientWidth - hPadding) /
currentPage.width * currentPage.scale;
var pageHeightScale = (this.container.clientHeight - vPadding) /
@@ -501,9 +510,12 @@ var PDFViewer = (function pdfViewer() {
width = dest[4] - x;
height = dest[5] - y;
var viewerContainer = this.container;
- widthScale = (viewerContainer.clientWidth - SCROLLBAR_PADDING) /
+ var hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;
+ var vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING;
+
+ widthScale = (viewerContainer.clientWidth - hPadding) /
width / CSS_UNITS;
- heightScale = (viewerContainer.clientHeight - SCROLLBAR_PADDING) /
+ heightScale = (viewerContainer.clientHeight - vPadding) /
height / CSS_UNITS;
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
break;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list