phaserjs / phaserjs/phaser

Problem with canvas centering

Open
#6,789 1 comment 0 reactions 1 assignee View on GitHub

@zekeatchan is already working on this.

Since Jan 22, 2025.

Dominant language
JavaScript
Stars
40.3k
Forks
7.2k
PR merge metrics
No merged PRs in 30d

Description

Version

  • Phaser Version: 3.80.1
  • Operating system: iOS 17.1.1, 17.0, 17.2, 17.3, 17.4
  • Browser: WKWebView

Description

Occasionally, but not always, on iOS operating systems the canvas is not centered within the div where it should be. This issue also occurs on a fresh Phaser instance that contains only one scene and one game object, so it is unlikely to be related to our implemented logic. It seems more probable that the problem is linked to the configuration settings. This Phaser project is incorporated into a Vue.js 3 environment.

Test Code

Vue.js 3 component

image
image
image

index.ts whre launch() function is defined

image

Phaser.Game config

image

Additional Information

The issue appears as shown in the attached image.
canvas

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.