mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Blurred pdf
Blurred pdf may happen if the screen is small. I modified pdfPlayer to avoid it.
This commit is contained in:
parent
f90169fa9a
commit
fa7a9aaee6
2 changed files with 13 additions and 7 deletions
0
git
Normal file
0
git
Normal file
|
@ -278,16 +278,22 @@ export class PdfPlayer {
|
||||||
|
|
||||||
renderPage(canvas, number) {
|
renderPage(canvas, number) {
|
||||||
this.book.getPage(number).then(page => {
|
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 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.width = viewport.width;
|
||||||
canvas.height = viewport.height;
|
canvas.height = viewport.height;
|
||||||
|
|
||||||
|
if (width<height) {
|
||||||
|
canvas.style.width = "100%";
|
||||||
|
canvas.style.height = "auto";
|
||||||
|
} else {
|
||||||
|
canvas.style.height = "100%";
|
||||||
|
canvas.style.width = "auto";
|
||||||
|
}
|
||||||
|
|
||||||
const renderContext = {
|
const renderContext = {
|
||||||
canvasContext: context,
|
canvasContext: context,
|
||||||
viewport: viewport
|
viewport: viewport
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue