mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: viewport.deviceScaleFactor can be set to system default (#9911)
This commit is contained in:
parent
c09b1b6948
commit
022c909326
@ -17,3 +17,7 @@ interface Viewport {
|
||||
#### Default value:
|
||||
|
||||
1
|
||||
|
||||
## Remarks
|
||||
|
||||
Setting this value to `0` will set the deviceScaleFactor to the system default.
|
||||
|
@ -34,7 +34,7 @@ export class EmulationManager {
|
||||
const mobile = viewport.isMobile || false;
|
||||
const width = viewport.width;
|
||||
const height = viewport.height;
|
||||
const deviceScaleFactor = viewport.deviceScaleFactor || 1;
|
||||
const deviceScaleFactor = viewport.deviceScaleFactor ?? 1;
|
||||
const screenOrientation: Protocol.Emulation.ScreenOrientation =
|
||||
viewport.isLandscape
|
||||
? {angle: 90, type: 'landscapePrimary'}
|
||||
|
@ -30,6 +30,10 @@ export interface Viewport {
|
||||
/**
|
||||
* Specify device scale factor.
|
||||
* See {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio | devicePixelRatio} for more info.
|
||||
*
|
||||
* @remarks
|
||||
* Setting this value to `0` will set the deviceScaleFactor to the system default.
|
||||
*
|
||||
* @defaultValue 1
|
||||
*/
|
||||
deviceScaleFactor?: number;
|
||||
|
Loading…
Reference in New Issue
Block a user