From 0e74f38d1658da25f44ceac4f514f6dc9ada2784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 16 Sep 2023 14:23:50 +0800 Subject: [PATCH] test scale --- app/views/publications/_viewer.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/publications/_viewer.html.erb b/app/views/publications/_viewer.html.erb index f4f31d3..f000224 100644 --- a/app/views/publications/_viewer.html.erb +++ b/app/views/publications/_viewer.html.erb @@ -847,7 +847,7 @@ enableXfa: ENABLE_XFA, disableFontFace: true }); - var pdfDoc = null, scale = 2.5; + var pdfDoc = null, scale = window.devicePixelRatio || 1; const container = flipbook[0]; flipbook.bind('zoom-min', function(){ flipbook_container.find('.cmdZoomOut').addClass('disabled'); @@ -889,6 +889,7 @@ var viewport = page.getViewport({ scale: scale }); // Support HiDPI-screens. var outputScale = (window.devicePixelRatio || 1) / 4; + outputScale = outputScale / viewport.width * flipbook.width(); canvas.width = Math.floor(viewport.width * outputScale); canvas.height = Math.floor(viewport.height * outputScale); canvas.style.width = "100%"; @@ -1082,7 +1083,7 @@ var viewport = page.getViewport({ scale: scale }); // Support HiDPI-screens. var outputScale = window.devicePixelRatio || 1; - + outputScale = outputScale / viewport.width * flipbook.width(); canvas.width = Math.floor(viewport.width * outputScale); canvas.height = Math.floor(viewport.height * outputScale); canvas.style.width = "100%";