From fa7a9aaee610c7594d987579c9b149c042f973c6 Mon Sep 17 00:00:00 2001 From: Zourlo <7470935+Zourlo@users.noreply.github.com> Date: Sun, 12 Feb 2023 21:59:22 +0900 Subject: [PATCH 1/5] Blurred pdf Blurred pdf may happen if the screen is small. I modified pdfPlayer to avoid it. --- git | 0 src/plugins/pdfPlayer/plugin.js | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 git diff --git a/git b/git new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 5f43d03fc9..1aaddabe6d 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -278,16 +278,22 @@ export class PdfPlayer { renderPage(canvas, number) { this.book.getPage(number).then(page => { - const original = page.getViewport({ scale: 1 }); + const width = dom.getWindowSize().innerWidth; + const height = dom.getWindowSize().innerHeight; + + const viewport = page.getViewport({ scale: 5 }); const context = canvas.getContext('2d'); - - const widthRatio = dom.getWindowSize().innerWidth / original.width; - const heightRatio = dom.getWindowSize().innerHeight / original.height; - const scale = Math.min(heightRatio, widthRatio); - const viewport = page.getViewport({ scale: scale }); - canvas.width = viewport.width; canvas.height = viewport.height; + + if (width Date: Mon, 13 Feb 2023 05:34:38 +0900 Subject: [PATCH 2/5] Update plugin.js --- src/plugins/pdfPlayer/plugin.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 1aaddabe6d..6322d42778 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -280,19 +280,18 @@ export class PdfPlayer { this.book.getPage(number).then(page => { const width = dom.getWindowSize().innerWidth; const height = dom.getWindowSize().innerHeight; - const viewport = page.getViewport({ scale: 5 }); const context = canvas.getContext('2d'); canvas.width = viewport.width; canvas.height = viewport.height; - if (width Date: Mon, 13 Feb 2023 05:41:22 +0900 Subject: [PATCH 3/5] Update plugin.js --- src/plugins/pdfPlayer/plugin.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 6322d42778..11722315bd 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -284,15 +284,15 @@ export class PdfPlayer { const context = canvas.getContext('2d'); canvas.width = viewport.width; canvas.height = viewport.height; - - if (width < height) { - canvas.style.width = '100%'; - canvas.style.height = 'auto'; + + if (width < height) { + canvas.style.width = '100%'; + canvas.style.height = 'auto'; } else { - canvas.style.height = '100%'; - canvas.style.width = 'auto'; + canvas.style.height = '100%'; + canvas.style.width = 'auto'; } - + const renderContext = { canvasContext: context, viewport: viewport From b61260ccb9bed192c57d864ace6291383ef109d6 Mon Sep 17 00:00:00 2001 From: Zourlo <7470935+Zourlo@users.noreply.github.com> Date: Wed, 15 Mar 2023 16:27:58 +0900 Subject: [PATCH 4/5] Update src/plugins/pdfPlayer/plugin.js change the default value for scale. Co-authored-by: Bill Thornton --- src/plugins/pdfPlayer/plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 9fab3b3e98..d306b0d426 100644 --- a/src/plugins/pdfPlayer/plugin.js +++ b/src/plugins/pdfPlayer/plugin.js @@ -281,7 +281,8 @@ export class PdfPlayer { this.book.getPage(number).then(page => { const width = dom.getWindowSize().innerWidth; const height = dom.getWindowSize().innerHeight; - const viewport = page.getViewport({ scale: 5 }); + const scale = Math.ceil(window.devicePixelRatio || 1); + const viewport = page.getViewport({ scale }); const context = canvas.getContext('2d'); canvas.width = viewport.width; canvas.height = viewport.height; From 45f1c004dbcb2869771f2fcec613d77cd3343322 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Tue, 11 Apr 2023 23:57:54 -0400 Subject: [PATCH 5/5] Delete empty git file --- git | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 git diff --git a/git b/git deleted file mode 100644 index e69de29bb2..0000000000