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

Is there a way to set .scene-container to width/height of 100vw/100vh? #201

Open
ralyodio opened this issue Apr 29, 2024 · 4 comments
Open

Comments

@ralyodio
Copy link

ralyodio commented Apr 29, 2024

Is there a way to set .scene-container to width/height of 100vw/100vh?

@ralyodio ralyodio changed the title Is there a way to set #scene-container to width/height of 100vw/100vh? Is there a way to set .scene-container to width/height of 100vw/100vh? Apr 29, 2024
@vasturiano
Copy link
Owner

@ralyodio the .width and .height methods are not CSS properties, they can only accept px units.
However, 100vw is equivalent to .width(window.innerWidth), which is the default. Same for height.

@ralyodio
Copy link
Author

ralyodio commented May 1, 2024

I saw this:

      world.width([event.target.innerWidth]);
      world.height([event.target.innerHeight]);

but i'm unclear why I'm passing an array. Is that correct?

@vasturiano
Copy link
Owner

No it should not be an array. Those methods take a single numeric argument. If you're reading it from the docs, the square brackets are there to indicate that the argument is optional. You can invoke it as a "getter" of the current width, without any arguments.

@ralyodio
Copy link
Author

ralyodio commented May 1, 2024

Makes sense.

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

No branches or pull requests

2 participants