editor icon indicating copy to clipboard operation
editor copied to clipboard

Resize in pcBootStrap on launch.js / __start__.js should set marginTop to 0 for Fill Mode fill window mode

Open yaustar opened this issue 2 years ago • 0 comments

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

  1. Launch the project
  2. Press 2 to change fill mode to keep aspect
  3. Resize the window
  4. Press 1 to change fill mode to fill window
  5. There is still a margin at the top of the page

https://user-images.githubusercontent.com/16639049/182608914-22ede087-5eee-45d1-93ca-a6a845f492ef.mp4

yaustar avatar Aug 03 '22 12:08 yaustar