afonsolage / bevy_ecss

Bevy crate which uses a subset of CSS to update Bevy ECS components
Apache License 2.0
98 stars 11 forks source link

CSS order is not respected #21

Closed TheBeardedQuack closed 9 months ago

TheBeardedQuack commented 1 year ago

Due to the properties being allowed to apply in parallel systems, and no ordering or culling of rules provided, the CSS order is not respected.

CSS specifies rule priority as follows:

And while not part of CSS, I think it would be ideal to have the ECS hierarchy also be implied. This would mean that rules specified on a StyleSheetAsset in a child entity, override those defined on a StyleSheetAsset attached to the parent entity.

I have an implementation where the ordering has been fixed, and managed to keep the asyncronous application of properties, through a builder step in the perpare_state(...) system. However my commit log was quite experimental. My fork also includes the mentioned node hierarchy, and pseudo-class support, so I can't throw it immediately into a PR. If someone is kind enough to create a clean PR from my fork I'm sure many would benefit from this fix (I can get around to it myself eventually but would like to focus on my game now I've fixed my issue).

TheBeardedQuack commented 1 year ago

I believe I now have this issue resolved, I have a tag in a forked project that includes this fix and pseudoclass support for buttons.

https://github.com/TheBeardedQuack/tomt_bevycss/releases/tag/0.4.0