Node events changed after 1.7 upgrade


#1

Hi , here is my code for using hover action on certain nodes.

registerHoverEvents: (node, onMouseEnter, onMouseLeave) => {
    var original = null;
    node.on(cc.Node.EventType.MOUSE_ENTER, function (event) {
        if (!!onMouseEnter) {
            // console.log(`what is that ${onMouseEnter}supposed to do`);
            onMouseEnter(event);
            if (!!event.myData) {
                original = event.myData;
            }
        }
    }, node);
    node.on(cc.Node.EventType.MOUSE_LEAVE, function (event) {
        if (!!onMouseLeave) {
            if (!!original) {
                event.myData = original;
            }
            onMouseLeave(event);
        }
    }, node);
},

But After upgrading to 1.7 , in certain cases, this code is behaving unexpectedly.
So i reverted back to 1.6 , and its working again as expected.

Can anyone tell me if something has changed in this release , regarding the node events.
Thank you


This.node.on('mouseenter') and mouseleave
#2

This is related to the following PR:


But this caused mouse event could be dispatched to brother node, which will be fixed in next v1.7 version, I have a tentative fix here, QA reported some other issues afterward, so need more investigate into it


#3

Okay.
Thanks for reply.
I shall wait for next release then :slight_smile:
I think my issue was that , node was calling on leave callback also ,just after on enter callback, while the mouse didnt leave the node’s bounding box.