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

Implement pseudo class selector #38

Closed afonsolage closed 11 months ago

afonsolage commented 11 months ago

Draft

I'm reworking system::prepare_state to support pseudo classes selectors. The main problem is find a way to have freedom to query for any component state, without having to statically add all of'em as query on CssQueryParam.


Fixes #18

Added

afonsolage commented 11 months ago

I've added most of the code, just need some docs and minor refactors, but one things that I've noticed is the style needs to update whenever the Interaction state is changed. This can be very performance intensive, so I'll have to take a closer look.

afonsolage commented 11 months ago

After more testing, I noticed that we have two issues to fix:

  1. [ ] Fix update order, as stated in #21, since when using :hover, usually you wanna the deepest property to have precedence;
  2. [ ] Watch for changes on entities, as in #39, because Interaction is updated on the fly and we need the StyleSheet to apply whenever it changes.

I think it's possible to do both fixed in one go, since I'll have to rework how entities and styles are managed.

afonsolage commented 11 months ago

I'll release 0.5.1, since it'll only make sense to use pseudo-classes when those two issues are fixed, and those issues will require a major change on how the crate works.

After releasing 0.5.1, I'll merge this PR and work on those issues, to release on 0.6.