processInteractive(interactionEvent, displayObject, func, hitTest, interactive)
    {
        if (!displayObject || !displayObject.visible)
        {
            return false;
        }

        const point = interactionEvent.data.global;

        // Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^
        //
        // This function will now loop through all objects and then only hit test the objects it HAS
        // to, not all of them. MUCH faster..
        // An object will be hit test if the following is true:
        //
        // 1: It is interactive.
        // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.
        //
        // As another little optimisation once an interactive object has been hit we can carry on
        // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests
        // A final optimisation is that an object is not hit test directly if a child has already been hit.

        interactive = displayObject.interactive || interactive;

        let hit = false;
        let interactiveParent = interactive;

        // if the displayobject has a hitArea, then it does not need to hitTest children.
        if (displayObject.hitArea)
        {
            interactiveParent = false;
        }
        // it has a mask! Then lets hit test that before continuing
        else if (hitTest && displayObject._mask)
        {
            if (!displayObject._mask.containsPoint(point))
            {
                hitTest = false;
            }
        }

        let keepHitTestingAfterChildren = hitTest;

        // ** FREE TIP **! If an object is not interactive or has no buttons in it
        // (such as a game scene!) set interactiveChildren to false for that displayObject.
        // This will allow pixi to completely ignore and bypass checking the displayObjects children.
        if (displayObject.interactiveChildren && displayObject.children)
        {
            const children = displayObject.children;

            for (let i = children.length - 1; i >= 0; i--)
            {
                const child = children[i];

                // time to get recursive.. if this function will return if something is hit..
                if (this.processInteractive(interactionEvent, 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 as we we
                    // now know the parent has been hit
                    interactiveParent = false;

                    // If the child is interactive , that means that the object hit was actually
                    // interactive and not just the child of an interactive object.
                    // This means we no longer need to hit test anything else. We still need to run
                    // through all objects, but we don't need to perform any hit tests.

                    keepHitTestingAfterChildren = false;

                    if (child.interactive)
                    {
                        hitTest = false;
                    }

                    // we can break now as we have hit an object.
                }
            }
        }

        hitTest = keepHitTestingAfterChildren;

        // no point running this if the item is not interactive or does not have an interactive parent.
        if (interactive)
        {
            // if we are hit testing (as in we have no hit any objects yet)
            // We also don't need to worry about hit testing if once of the displayObjects children
            // has already been hit!
            if (hitTest && !hit)
            {
                if (displayObject.hitArea)
                {
                    displayObject.worldTransform.applyInverse(point, this._tempPoint);
                    hit = displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y);
                }
                else if (displayObject.containsPoint)
                {
                    hit = displayObject.containsPoint(point);
                }
            }

            if (displayObject.interactive)
            {
                if (hit && !interactionEvent.target)
                {
                    interactionEvent.target = displayObject;
                }

                func(interactionEvent, displayObject, hit);
            }
        }

        return hit;
    }
/**
     * This function is provides a neat way of crawling through the scene graph and running a
     * specified function on all interactive objects it finds. It will also take care of hit
     * testing the interactive objects and passes the hit across in the function.
     *
     * @private
     * @param {InteractionEvent} interactionEvent - event containing the point that
     *  is tested for collision
     * @param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - the displayObject
     *  that will be hit test (recursively crawls its children)
     * @param {Function} [func] - the function that will be called on each interactive object. The
     *  interactionEvent, displayObject and hit will be passed to the function
     * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point
     * @param {boolean} [interactive] - Whether the displayObject is interactive
     * @return {boolean} returns true if the displayObject hit the point
     */
This function is provides a neat way of crawling through the scene graph and running a
specified function on all interactive objects it finds. It will also take care of hit
testing the interactive objects and passes the hit across in the function.

@private
@param {InteractionEvent} interactionEvent - event containing the point that
is tested for collision
@param {PIXI.Container|PIXI.Sprite|PIXI.extras.TilingSprite} displayObject - the displayObject
that will be hit test (recursively crawls its children)
@param {Function} [func] - the function that will be called on each interactive object. The
interactionEvent, displayObject and hit will be passed to the function
@param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point
@param {boolean} [interactive] - Whether the displayObject is interactive
@return {boolean} returns true if the displayObject hit the point
This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds . It will also take care of hit testing the interactive objects and passes the hit across in the function . @private @param { InteractionEvent } interactionEvent - event containing the point that is tested for collision @param { PIXI . Container|PIXI . Sprite|PIXI . extras . TilingSprite } displayObject - the displayObject that will be hit test ( recursively crawls its children ) @param { Function } [ func ] - the function that will be called on each interactive object . The interactionEvent displayObject and hit will be passed to the function @param { boolean } [ hitTest ] - this indicates if the objects inside should be hit test against the point @param { boolean } [ interactive ] - Whether the displayObject is interactive @return { boolean } returns true if the displayObject hit the point
processInteractive(interactionEvent, displayObject, func, hitTest, interactive)
    {
        if (!displayObject || !displayObject.visible)
        {
            return false;
        }
        const point = interactionEvent.data.global;
         This function will now loop through all objects and then only hit test the objects it HAS
         to, not all of them. MUCH faster..
         An object will be hit test if the following is true:
         1: It is interactive.
         2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.
         As another little optimisation once an interactive object has been hit we can carry on
         through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests
         A final optimisation is that an object is not hit test directly if a child has already been hit.
        interactive = displayObject.interactive || interactive;
        let hit = false;
        let interactiveParent = interactive;
         if the displayobject has a hitArea, then it does not need to hitTest children.
        if (displayObject.hitArea)
        {
            interactiveParent = false;
        }
         it has a mask! Then lets hit test that before continuing
        else if (hitTest && displayObject._mask)
        {
            if (!displayObject._mask.containsPoint(point))
            {
                hitTest = false;
            }
        }
        let keepHitTestingAfterChildren = hitTest;
         ** FREE TIP **! If an object is not interactive or has no buttons in it
         (such as a game scene!) set interactiveChildren to false for that displayObject.
         This will allow pixi to completely ignore and bypass checking the displayObjects children.
        if (displayObject.interactiveChildren && displayObject.children)
        {
            const children = displayObject.children;
            for (let i = children.length - 1; i >= 0; i--)
            {
                const child = children[i];
                 time to get recursive.. if this function will return if something is hit..
                if (this.processInteractive(interactionEvent, 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 as we we
                     now know the parent has been hit
                    interactiveParent = false;
                     If the child is interactive , that means that the object hit was actually
                     interactive and not just the child of an interactive object.
                     This means we no longer need to hit test anything else. We still need to run
                     through all objects, but we don't need to perform any hit tests.
                    keepHitTestingAfterChildren = false;
                    if (child.interactive)
                    {
                        hitTest = false;
                    }
                     we can break now as we have hit an object.
                }
            }
        }
        hitTest = keepHitTestingAfterChildren;
         no point running this if the item is not interactive or does not have an interactive parent.
        if (interactive)
        {
             if we are hit testing (as in we have no hit any objects yet)
             We also don't need to worry about hit testing if once of the displayObjects children
             has already been hit!
            if (hitTest && !hit)
            {
                if (displayObject.hitArea)
                {
                    displayObject.worldTransform.applyInverse(point, this._tempPoint);
                    hit = displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y);
                }
                else if (displayObject.containsPoint)
                {
                    hit = displayObject.containsPoint(point);
                }
            }
            if (displayObject.interactive)
            {
                if (hit && !interactionEvent.target)
                {
                    interactionEvent.target = displayObject;
                }
                func(interactionEvent, displayObject, hit);
            }
        }
        return hit;
    }
processInteractive ( interactionEvent , displayObject , func , hitTest , interactive ) { if ( ! displayObject || ! displayObject . visible ) { return false ; } const point = interactionEvent . data . global ; interactive = displayObject . interactive || interactive ; let hit = false ; let interactiveParent = interactive ; if ( displayObject . hitArea ) { interactiveParent = false ; } else if ( hitTest && displayObject . _mask ) { if ( ! displayObject . _mask . containsPoint ( point ) ) { hitTest = false ; } } let keepHitTestingAfterChildren = hitTest ; if ( displayObject . interactiveChildren && displayObject . children ) { const children = displayObject . children ; for ( let i = children . length - 1 ; i >= 0 ; i -- ) { const child = children [ i ] ; if ( this . processInteractive ( interactionEvent , child , func , hitTest , interactiveParent ) ) { if ( ! child . parent ) { continue ; } hit = true ; interactiveParent = false ; keepHitTestingAfterChildren = false ; if ( child . interactive ) { hitTest = false ; } } } } hitTest = keepHitTestingAfterChildren ; if ( interactive ) { if ( hitTest && ! hit ) { if ( displayObject . hitArea ) { displayObject . worldTransform . applyInverse ( point , this . _tempPoint ) ; hit = displayObject . hitArea . contains ( this . _tempPoint . x , this . _tempPoint . y ) ; } else if ( displayObject . containsPoint ) { hit = displayObject . containsPoint ( point ) ; } } if ( displayObject . interactive ) { if ( hit && ! interactionEvent . target ) { interactionEvent . target = displayObject ; } func ( interactionEvent , displayObject , hit ) ; } } return hit ; }
This function is provides a neat way of crawling through the scene graph and running a
 specified function on all interactive objects it finds.
This function is provides a neat way of crawling through the scene graph and running a specified function on all interactive objects it finds .
// Took a little while to rework this function correctly! But now it is done and nice and optimised. ^_^ // // This function will now loop through all objects and then only hit test the objects it HAS // to, not all of them. MUCH faster.. // An object will be hit test if the following is true: // // 1: It is interactive. // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. // // As another little optimisation once an interactive object has been hit we can carry on // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests // A final optimisation is that an object is not hit test directly if a child has already been hit. // if the displayobject has a hitArea, then it does not need to hitTest children. // it has a mask! Then lets hit test that before continuing // ** FREE TIP **! If an object is not interactive or has no buttons in it // (such as a game scene!) set interactiveChildren to false for that displayObject. // This will allow pixi to completely ignore and bypass checking the displayObjects children. // time to get recursive.. if this function will return if something is hit.. // its a good idea to check if a child has lost its parent. // this means it has been removed whilst looping so its best // we no longer need to hit test any more objects in this container as we we // now know the parent has been hit // If the child is interactive , that means that the object hit was actually // interactive and not just the child of an interactive object. // This means we no longer need to hit test anything else. We still need to run // through all objects, but we don't need to perform any hit tests. // we can break now as we have hit an object. // no point running this if the item is not interactive or does not have an interactive parent. // if we are hit testing (as in we have no hit any objects yet) // We also don't need to worry about hit testing if once of the displayObjects children // has already been hit!