-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
setVisible not working for DOM elements in a container #5816
Comments
It still works, use const text = this.add.dom(0, 0, "span", { color: "white" }, "Hello"); |
It doesn't work, in fact. 😄 |
The more general issue is #5817. In fact sprite animations, (more generally, anything with |
Well, this still works: const text = this.add.dom(0, 0, "span", { color: "white" }, "Hello");
this.add.container(0, 0, [text]).setVisible(false);
// `text` will also be invisible I agree that this issue would be better addressed without |
Check parent visibility in preRender() Fixes phaserjs#5816
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
Version
Description
It seems like the fix in #4486 is no longer working. When the visibility of the parent container is changed, the DOM node is still visible. I am able to determine that it is because
preUpdate
is not being called on DOM elements, though I am not sure why.Example Test Code
See a demo: https://codepen.io/prakol16/pen/rNwVyvv
Additional Information
In addition, perhaps the
preUpdate
code should be moved to apreStep
event on the game. The reason for this is because if a scene is paused, the visibility of various objects can still change, butpreUpdate
will never be called. Similarly, if the container/its children are changed to be inactive withsetActive(false)
, we'd expect the visibility to still be controlled separately bysetVisible
, but instead, the visibility of the DOM element will no longer change.The text was updated successfully, but these errors were encountered: