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

Calling setHidden(true) on layer does not clear event listeners on children. #20

Open
tonistiigi opened this issue Jan 26, 2012 · 2 comments

Comments

@tonistiigi
Copy link
Member

Calling setHidden(true) on layer does not clear event listeners on children.

Solution 1:
Calling setHidden(true) on layer should also call setHidden(true) on children objects. This would need extra value to see if call was inherited to have correct behavior on setHidden(false).

Solution 2:
Rewrite getHidden() method to scan all the parents and return true if one of them is hidden. Simpler but has performance penalty.

Originated from: http://groups.google.com/group/limejs/browse_thread/thread/08688d9c605f0a5a#

@pnico
Copy link

pnico commented Apr 15, 2012

I disagree, with both the idea that event listeners should be cleared and that getHidden() should return true because a layer or parent node is hidden. The child nodes of a hidden node should not appear on screen, but they should retain their own local "hidden" property.

Re. event listeners, I don't think they should be cleared, but I do think hitTest() should always return false for nodes that are not visible on screen, so when a node is not visible (unless maybe if its alpha is 0 but it is not hidden), things like mouse events would not fire on them. Maybe this is your issue anyway?

@tonistiigi
Copy link
Member Author

There is already fix for it by @ducklord 75bbb41 that will probably be merged to master.

It does the parent check before triggering the event. I would let it stay this way instead of moving it to hitTest to allow hitTest to be overridden by user if there is a need for it.

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

No branches or pull requests

2 participants