Jump to content

mouse behavior change between 3.0.8 and higher


Mathieu Anthoine
 Share

Recommended Posts

In Pixi 3.0.8, if a Sprite (named "A") has its interactive property to true and has a function listening the "click" event, the sprites that are under "A" (with interactive to true and a function listening to click) don't fire a click event. "A" stops the propagation under it.

In Pixi 3.0.9 and higher, sprites that are under "A", fire the click event.

Is there a behavior change ? is it a bug ?

Thanks in advance

Link to comment
Share on other sites

The differences in the code that create the different behaviors are here (in the processInteractive method of InteractionManager) : 

VERSION 3.1.0

            var child = children;
			
            // time to get recursive.. if this function will return if somthing is hit..
            if(this.processInteractive(point, child, func, hitTest, interactiveParent))
            {
                // its a good idea to check if a child has lost its parent.
                // this means it has been removed whilst looping so its best
                if(!child.parent)
                {
                    continue;
                }
				
				hit = true;
				
                // we no longer need to hit test any more objects in this container ...
                //interactiveParent = false;
                
                // If the child is interactive , that means that the object hit was ...
                // This means we no longer need to hit test anything else. We still ...
                if(child.interactive)
                {
                    hitTest = false;
                }
            }

VERSION 3.0.8


            if(! hit  && hitTest)
            {
                hit = this.processInteractive(point, children, func, true, interactive );
            }
            else
            {
                // now we know we can miss it all!
                this.processInteractive(point, children, func, false, false );
            }

 

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...