editor
editor copied to clipboard
Resize in pcBootStrap on launch.js / __start__.js should set marginTop to 0 for Fill Mode fill window mode
Changing from/to Canvas fill modes to FILL WINDOW doesn't change the position of the canvas to be the top of the screen
if (fillMode == pc.FILLMODE_NONE || fillMode == pc.FILLMODE_KEEP_ASPECT) {
if ((fillMode == pc.FILLMODE_NONE && canvas.clientHeight < window.innerHeight) || (canvas.clientWidth / canvas.clientHeight >= window.innerWidth / window.innerHeight)) {
canvas.style.marginTop = Math.floor((window.innerHeight - canvas.clientHeight) / 2) + 'px';
} else {
canvas.style.marginTop = '';
}
}
Project: https://playcanvas.com/project/965722/overview/switch-fill-mode
- Launch the project
- Press 2 to change fill mode to keep aspect
- Resize the window
- Press 1 to change fill mode to fill window
- There is still a margin at the top of the page
https://user-images.githubusercontent.com/16639049/182608914-22ede087-5eee-45d1-93ca-a6a845f492ef.mp4