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

Children should listen to size changes on parents and re-render as needed. #56

Closed
trusktr opened this issue Sep 13, 2016 · 1 comment
Closed
Labels

Comments

@trusktr
Copy link
Member

trusktr commented Sep 13, 2016

Currently, resizing the scene by external means (f.e. resizing the container of a <motor-scene> element) does not cause necessary re-rendering to happen. This causes the problem that if something is proportionally sized (which can ultimately depend on the size of the root <motor-scene> element), then mountPoint calculations will fail because the thing who's mountPoint is being set will not have an updated size, so the mountPoint offset will be incorrect.

There is currently no way to do this reliably except with polling (though that will change soon with the ResizeObserver coming to the web soon). So, we'll poll for now.

We need a good way to do this without simply traversing the entire tree and re-rendering everything. We need a way to listen to size changes (and hence why I'm working on issue #54), in order to re-render only specific nodes that depend on the size updates.

This depends on #54 being completed first. This will also solve #19.

@trusktr trusktr added the bug label Oct 9, 2016
@trusktr trusktr added this to the Initial API, then time for demos. milestone Oct 9, 2016
@trusktr trusktr changed the title Listen to size changes on the scene, then re-render child nodes as needed. Children should listen to size changes on parents and re-render as needed. Oct 11, 2016
@trusktr
Copy link
Member Author

trusktr commented Oct 11, 2016

I increased the scope of this issue so that size change events are fired for any node whose size changes, not just the scene. It's really nice, and it's synchronized with the browser's animation loop, so resizing is sharp and smooth (rather than laggy like when re-rendering on window resize events).

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

No branches or pull requests

1 participant