Resizing multiple scenes

Hi all,

Just wanted to start by saying this looks really great so far. I’ve been learning and using Cesium for about a month and a half now, and it’s been fun to pick through.

I’m now trying to create multiple scenes on the same page. I have different canvases for each scene, and each scene is being generated by a separate JavaScript file. Everything’s displaying and running well, except that I’m having trouble when I resize the window. The resize handler in the Skeleton file relies on the window.onresize event, which as far as I can tell can’t be passed into separate script files. Has anyone run across this issue before and know how to address it, or is there something I’m missing here that would make this easier? I’d like to avoid combining all three files into one if possible, since renaming variables would become quite a headache. Thanks!

I’ll hazard a guess here. The Skeleton example uses old-fashioned “window.resize = function() {…}” to handle this situation. This was probably done to get the thing working in a hurry, but it doesn’t work for multiple copies because each copy overwrites the previous one’s event handler. Instead, we should be using “addEventListener”.

So the code would look something like “window.addEventListener(‘resize’, function () {…}, false);”


I added it. Give it a try and let me know if it fixes your problem. Thanks!


This is exactly what I was looking for. Thank you.