Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas is weirdly resized upon window resize #1231

Open
hornta opened this issue Jun 22, 2024 · 5 comments
Open

canvas is weirdly resized upon window resize #1231

hornta opened this issue Jun 22, 2024 · 5 comments
Labels

Comments

@hornta
Copy link
Collaborator

hornta commented Jun 22, 2024

The canvas is weirdly resized upon resizing the browser window. I noticed it when I alt+tabbed between my IDE and the browser, the canvas slowly get larger.

import { Text, device, game, video } from 'melonjs';

device.onReady(function () {
  // initialize the display canvas once the device/browser is ready
  if (!video.init(100, 30, {parent : "screen", scale : "auto"})) {
      alert("Your browser does not support HTML5 canvas.");
      return;
  }

  // set a gray background color
  game.world.backgroundColor.parseCSS("#202020");

  // add a font text display object
  game.world.addChild(new Text(609, 281, {
      font: "Arial",
      size: 160,
      fillStyle: "#FFFFFF",
      textBaseline : "middle",
      textAlign : "center",
      text : "Hello World !"
  }));
});

9db458ca-162c-47db-acd3-f766e4c1ddcc

@hornta hornta added the Bug label Jun 22, 2024
@KUNDAN1334
Copy link

can i work on this issue?

@obiot
Copy link
Member

obiot commented Jun 29, 2024

Please yes, sorry i was distracted with our other discussion and forgot about this one

@obiot
Copy link
Member

obiot commented Jun 29, 2024

To be noted that the same behavior appears when showing the developer tools within the browser. Since it does not happened in other cases, it never really bothered me.

@obiot
Copy link
Member

obiot commented Jun 30, 2024

@KUNDAN1334 just a heads up, in case you haven't started yet, we just pushed some big changes on the build process ! make sure to update your repo first before starting any changes. Sorry about that ! :P

@KUNDAN1334
Copy link

Thanks for the heads up! I will update my local repo with the latest changes before starting on the issue. Appreciate the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants