From 2f4423cffb8efc2fdddc3bcbfd250627e49dcd34 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Wed, 11 Apr 2012 09:42:41 -0700 Subject: [PATCH] Fixing zoom and rotate issues --- src/api.js | 2 +- web/viewer.js | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/api.js b/src/api.js index 3d97f53c9..cccd4b152 100644 --- a/src/api.js +++ b/src/api.js @@ -19,7 +19,7 @@ return this.page.view; }, getViewport: function(scale, rotate) { - if (arguments < 2) + if (arguments.length < 2) rotate = this.rotate; return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0); }, diff --git a/web/viewer.js b/web/viewer.js index 9fe9a1714..3c7279fb4 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -747,8 +747,6 @@ var PageView = function pageView(container, pdfPage, id, scale, var viewport = this.pdfPage.getViewport(this.scale); this.viewport = viewport; - this.width = viewport.width; - this.height = viewport.height; div.style.width = viewport.width + 'px'; div.style.height = viewport.height + 'px'; @@ -763,6 +761,20 @@ var PageView = function pageView(container, pdfPage, id, scale, div.appendChild(this.loadingIconDiv); }; + Object.defineProperty(this, 'width', { + get: function PageView_getWidth() { + return this.viewport.width; + }, + enumerable: true + }); + + Object.defineProperty(this, 'height', { + get: function PageView_getHeight() { + return this.viewport.height; + }, + enumerable: true + }); + function setupAnnotations(pdfPage, viewport) { function bindLink(link, dest) { link.href = PDFView.getDestinationHash(dest);