Open Zeenobit opened 4 months ago
So far, I've tried all of the following, and nothing seems to work:
.css
vs. different .css
.hide
instead of hide
when adding/removing selectorsdisplay: flex
from #ControlPanel
#ControlPanel .hide
as an explicit ruleI've been trying to debug the crate on my own, but I'm having trouble understanding how/where the class rules are being applied. Based on my debugging so far, my entity is definitely being picked up by select_entities_node
. But I can't find where the class rules are actually being applied after a .refresh()
request is sent out.
I've been looking at the examples as well, and as far as I can tell, none of them deal with adding/removing classes dynamically. Is this supported at all?
Any information would be greatly appreciated!
I managed to solve it by defining #ControlPanel.hide
as an explicit rule:
#ControlPanel.hide {
display: none;
}
Note the difference between #ControlPanel.hide
and #ControlPanel .hide
from my previous comment. 🫠
It would've been amazing if these types of issues generated warnings/errors.
For some reason, having the class defined globally as .hide
doesn't work at all.
I've managed to get most of this crate functional in my project by having a root UI node with a couple of style sheets. I have a system which refreshes my stylesheet on any changes:
This system runs in
Update
schedule after all my UI logic is finished. Specifically, it runs after a system which adds/removes a class to a specific node:The style is defined as:
I've verified that this class does indeed get added. If I turn on tracing for
bevy_ecss
, I do get:However, the observed behavior is that
display
is always set toflex
. Despite the.hide
class being added/removed correctly and the style sheet getting refreshed.At this point I'm not sure if this an issue with my CSS, setup, or the crate. As far as I can tell, my setup and CSS is fine, although my CSS knowledge is a bit outdated; so it's entirely possible the issue is on my end. :)
Any help would be appreciated!