mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix blurry pdf player rendering for all viewport sizes (#6182)
This commit is contained in:
parent
a0b944b299
commit
7e4921f1dc
1 changed files with 5 additions and 11 deletions
|
@ -290,22 +290,16 @@ export class PdfPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPage(canvas, number) {
|
renderPage(canvas, number) {
|
||||||
|
const devicePixelRatio = window.devicePixelRatio || 1;
|
||||||
this.book.getPage(number).then(page => {
|
this.book.getPage(number).then(page => {
|
||||||
const width = dom.getWindowSize().innerWidth;
|
const original = page.getViewport({ scale: 1 });
|
||||||
const height = dom.getWindowSize().innerHeight;
|
const scale = Math.max((window.screen.height / original.height), (window.screen.width / original.width)) * devicePixelRatio;
|
||||||
const scale = Math.ceil(window.devicePixelRatio || 1);
|
|
||||||
const viewport = page.getViewport({ scale });
|
const viewport = page.getViewport({ scale });
|
||||||
const context = canvas.getContext('2d');
|
|
||||||
canvas.width = viewport.width;
|
canvas.width = viewport.width;
|
||||||
canvas.height = viewport.height;
|
canvas.height = viewport.height;
|
||||||
|
|
||||||
if (width < height) {
|
const context = canvas.getContext('2d');
|
||||||
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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue