vasturiano / globe.gl

UI component for Globe Data Visualization using ThreeJS/WebGL
https://vasturiano.github.io/globe.gl/example/world-population/
MIT License
1.97k stars 293 forks source link

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

Open ralyodio opened 2 months ago

ralyodio commented 2 months ago

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

vasturiano commented 2 months ago

@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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

Makes sense.