Jump to content

Can containsPoint be moved to Container?


intoxopox
 Share

Recommended Posts

By definition, if element has containsPoint(), its called when we determine if mouse clicked on that object. If you add it to the container, it'll be a disaster, because it will analyze container and its children two times. If there are three containers in eachother , that would be 8 times. 

There are other fields like that: filterArea, maskArea, e.t.c. , they don't care about children.

So, if its implemented it will definitely have different name. Why do you even need that?

Link to comment
Share on other sites

I see. That makes sense. My particular use case is I have containers which have both sprite and graphic children. I was hoping to use something like containsPoint to see if mouse was still over any of the children. Further, I had abstracted this call in such a way that sometimes it would be called on one of the children and sometimes it would be called on the parent container. I can work around this ok, but just thought I had found a good reason to move the call to container and perhaps, in doing so, slightly improve the polymorphism. However, I see what you're saying.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...