Skip to content

Commit 4045d77

Browse files
committed
Add visualViewport
1 parent 4edd0e9 commit 4045d77

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DebugGameScalePlugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { aspectModeToString, rectToString, sizeToString, vectorToString, xyToString, logEnterFullscreen, logFullscreenFailed, logFullscreenUnsupported, logLeaveFullscreen, logOrientationChange, logResize } from './util'
1+
import { aspectModeToString, rectToString, sizeToString, xyToString, logEnterFullscreen, logFullscreenFailed, logFullscreenUnsupported, logLeaveFullscreen, logOrientationChange, logResize } from './util'
22

33
const { POST_RENDER } = Phaser.Core.Events
44

@@ -59,7 +59,7 @@ export default class DebugGameScalePlugin extends Phaser.Plugins.BasePlugin {
5959
const h = 128
6060
let x = ~~Math.max(0, cx - 0.5 * w)
6161
let y = ~~Math.max(0, cy - 0.5 * h)
62-
const dy = 16
62+
const dy = 15
6363
const sx = 1 / scale.displayScale.x
6464
const sy = 1 / scale.displayScale.y
6565

@@ -89,9 +89,9 @@ export default class DebugGameScalePlugin extends Phaser.Plugins.BasePlugin {
8989
c.fillText(`screen: ${screen.width}×${screen.height} [${(screen.width / screen.height).toFixed(3)}] DPR=${devicePixelRatio}`, x, (y += dy))
9090
}
9191
if (visualViewport) {
92-
const { offsetLeft, offsetTop, width, height } = visualViewport;
92+
const { offsetLeft, offsetTop, width, height, scale } = visualViewport
9393

94-
c.fillText(`visualViewport: ${offsetLeft}, ${offsetTop}, ${width}, ${height}`, x, (y += dy))
94+
c.fillText(`visualViewport: offsetLeft=${offsetLeft} offsetTop=${offsetTop} width=${width}, height=${height} scale=${scale}`, x, (y += dy))
9595
}
9696
}
9797
}

0 commit comments

Comments
 (0)