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

button touch event error when buttons overlap #18852

Open
drelaptop opened this issue May 25, 2018 · 0 comments

Comments

@drelaptop
Copy link
Contributor

commented May 25, 2018

Description

I’m having problems with buttons events.
in my main scene, I’ve a ‘Play’ button and this is the event that I defined:

bPlay->addTouchEventListener(CC_CALLBACK_1(EventHandler::onTouchButtonPlay, EventHandler::getInstance()));

It works fine.
Below Play button, I’ve another button, and when I touch that button it opens a window (i created a layer and added a window image, with buttons).

One of the buttons that I added in the window, is overlapped with the Play button, because, despite of I’m “simulating” a window with a layer, the scene is the same.

This is the event that I defined in the button (window button):

buttonWindow->addTouchEventListener([&](Ref* sender, cocos2d::ui::Widget::TouchEventType type)
        {
             ...
        });

The problem is, when I touch the window button, the action is the event that I defined for Play button instead of the event that I defined for window button.

This is because the buttons are overlapped.
How can I solve it? Can I define / set / unset a event priority for buttons? If yes, how to?

Look this image,

button-event

@drelaptop drelaptop modified the milestones: 3.17.1, next Nov 14, 2018

@minggo minggo modified the milestones: 3.17.2, next Apr 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.