starback.js icon indicating copy to clipboard operation
starback.js copied to clipboard

When zooming in/out, the particles don't fill the whole page.

Open goteusz-maszyk opened this issue 1 year ago • 2 comments

That's it.

goteusz-maszyk avatar Mar 26 '24 18:03 goteusz-maszyk

Could you provide steps and reproduction to this issue? Images or videos would help a lot

zuramai avatar Apr 02 '24 08:04 zuramai

This is just a misunderstanding of how the library works--the width and height of the canvas are static, passed in when the Starback object is first created. If you want to dynamically adjust the size of the canvas to match the viewport, you can resize the canvas element itself whenever the window resizes with something like this:

window.addEventListener("resize", () => {
  canvas.setAttribute("width", window.innerWidth);
  canvas.setAttribute("height", window.innerHeight);
}

it might be worthwhile to look into building this reactivity into the library itself, however this isn't really an advertised feature and as such is not a bug

justDeeevin avatar Jan 10 '25 23:01 justDeeevin