playcanvas / playcanvas/engine

[Breaking change] Make the canvas size control independent from the Engine

Open
#3,115 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: graphics enhancement
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

At the moment, the Engine directly changes the dimensions of the canvas in application resizeCanvas function https://github.com/playcanvas/engine/blob/master/src/framework/application.js#L1535

With the Editor, there is some co-dependency between the HTML JS code and the engine to get the right result.

The proposal is to change this change this to make it so that the dimensions of the canvas is purely driving by the CSS/HTML layout and the engine will match the resolution to the canvas via this ticket: https://github.com/playcanvas/engine/issues/3114

It would make the responsibility for the canvas sizing much clearer and easier to maintain.

The disadvantage is that this would be a breaking change as we would remove some of the API around the fill type and break an existing applications that depend on these properties.

There's also a question on how to roll this out without needing to release both the engine and the editor at the same time.

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.

Research direction

Read src/framework/application.js at resizeCanvas and follow the Editor’s HTML/JS canvas-sizing path described in the issue. Compare the proposed resolution-matching work in issue #3114; done means CSS/HTML layout owns the canvas dimensions, the engine follows that size, and the breaking API and engine-editor rollout are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.