mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:01:31 +00:00
ENH - integrate latest shared app updates
# Conflicts: # sky_phone/source/html/index.html
This commit is contained in:
@@ -223,13 +223,14 @@ function toggleOrientation(): void {
|
||||
)
|
||||
}
|
||||
|
||||
function resizeGameView(): void {
|
||||
function resizeGameView(entry?: ResizeObserverEntry): void {
|
||||
if (!gameCanvas.value || !gameView) return
|
||||
const bounds = gameCanvas.value.getBoundingClientRect()
|
||||
const width = entry?.contentRect.width ?? gameCanvas.value.offsetWidth
|
||||
const height = entry?.contentRect.height ?? gameCanvas.value.offsetHeight
|
||||
const renderScale = Math.min(window.devicePixelRatio, 2)
|
||||
gameView.resize(
|
||||
Math.max(1, Math.round(bounds.width * renderScale)),
|
||||
Math.max(1, Math.round(bounds.height * renderScale)),
|
||||
Math.max(1, Math.round(width * renderScale)),
|
||||
Math.max(1, Math.round(height * renderScale)),
|
||||
window.innerWidth,
|
||||
window.innerHeight,
|
||||
)
|
||||
@@ -238,7 +239,7 @@ function resizeGameView(): void {
|
||||
function startGameView(): void {
|
||||
if (isDevelopment || !gameCanvas.value) return
|
||||
gameView = createGameView(gameCanvas.value)
|
||||
resizeObserver = new ResizeObserver(resizeGameView)
|
||||
resizeObserver = new ResizeObserver((entries) => resizeGameView(entries[0]))
|
||||
resizeObserver.observe(gameCanvas.value)
|
||||
resizeGameView()
|
||||
const render = () => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Sky Phone</title>
|
||||
<script type="module" crossorigin src="./assets/sky-index-DRBwPFbv.js"></script>
|
||||
<script type="module" crossorigin src="./assets/sky-index-B4MXmmtY.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/sky-index-CjumOQDu.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user