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] 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 000000000..e69de29bb diff --git a/src/plugins/pdfPlayer/plugin.js b/src/plugins/pdfPlayer/plugin.js index 5f43d03fc..1aaddabe6 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