EventListenerMouse onMouseUp fires twice

I have a mouse listener event attached to a sprite. When I click, the onMouseUp event triggers twice. This is the only EventListenerMouse and I have no touch events. Is this a bug?

auto mouseListener = EventListenerMouse::create();

mouseListener->onMouseUp = [&](Event *event) {
	auto mouse = dynamic_cast<EventMouse*>(event);
	log("%d", mouse->getMouseButton());  //logs twice
};

_eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this); //"this" is a custom sprite object

bump (needs 10 characters)

I cant repro this. its working fine for me

I realised the problem. I was accidentally creating a scene as a child of another scene which caused the click event to be called twice.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.