-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Don't render if width or height is 0. #896
Conversation
I still get an immediate crash when setting the canvas to display: none. |
What exactly are you doing? I've tried several different things and it works fine for me. |
As briefly discussed offline, I discovered that Scene is calling clientHeight and clientWidth on the canvas every frame, so there seems to be no reason why we shouldn't just call |
Sounds good to me. I don't know why we didn't think of that earlier. |
I tried to do a bit of archaeology to figure out when we stopped resizing every frame. I couldn't find it, but I know for Santa I reduced how often resize was called to lower CPU usage. That may have been primarily to help performance for 2D in IE, or possibly browsers have improved since then. I tested Chrome and FF, and don't see any CPU difference nor profiler difference between resizing every frame and the current behavior. I'll commit to this branch and you can check my work. |
Removes the need for window resize listeners as well.
So can't we just remove |
@shunter I'd like to get this in to b18, are there any hold-ups? |
Having |
Fair enough I guess. So is this ready? |
I think so, yes. |
I was going to see if @emackey could try this in our internal Cesium app that has a complicated HTML UI to make sure there's no problems with the resize. |
Doesn't appear to add any additional hurt to the performance. |
Don't render if width or height is 0.
Fixes #834
I'm not sure if there's a better way to do this at a level lower than the widget, but it seem like a problem that needs to be addressed as part of the render loop.