Commit 3430a94 1 parent 5d03c57 commit 3430a94 Copy full SHA for 3430a94
File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -293,12 +293,20 @@ export class PdfPlayer {
293
293
const devicePixelRatio = window . devicePixelRatio || 1 ;
294
294
this . book . getPage ( number ) . then ( page => {
295
295
const original = page . getViewport ( { scale : 1 } ) ;
296
- const scale = Math . max ( ( window . screen . height / original . height ) , ( window . screen . width / original . width ) ) * devicePixelRatio ;
296
+ const scale = Math . min ( ( window . innerHeight / original . height ) , ( window . innerWidth / original . width ) ) * devicePixelRatio ;
297
297
const viewport = page . getViewport ( { scale } ) ;
298
298
299
299
canvas . width = viewport . width ;
300
300
canvas . height = viewport . height ;
301
301
302
+ if ( window . innerWidth < window . innerHeight ) {
303
+ canvas . style . width = '100%' ;
304
+ canvas . style . height = 'auto' ;
305
+ } else {
306
+ canvas . style . height = '100%' ;
307
+ canvas . style . width = 'auto' ;
308
+ }
309
+
302
310
const context = canvas . getContext ( '2d' ) ;
303
311
304
312
const renderContext = {
You can’t perform that action at this time.
0 commit comments