This commit is contained in:
halx99 2021-09-23 14:53:57 +08:00
parent e83c8b1c08
commit 629625a976
1 changed files with 4 additions and 4 deletions

View File

@ -30,13 +30,13 @@ public:
auto listener = EventListenerTouchOneByOne::create();
listener->setSwallowTouches(true);
listener->onTouchBegan = [this](Touch* touch, Event*) -> bool {
return ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow);
return ImGui::GetIO().WantCaptureMouse;
};
_trackLayer->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, _trackLayer);
// add by halx99
auto stopAnyMouse = [=](EventMouse* event) {
if (ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)) {
if (ImGui::GetIO().WantCaptureMouse) {
event->stopPropagation();
}
};
@ -92,13 +92,13 @@ public:
_touchListener = utils::newInstance<EventListenerTouchOneByOne>();
_touchListener->setSwallowTouches(true);
_touchListener->onTouchBegan = [this](Touch* touch, Event*) -> bool {
return ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow);
return ImGui::GetIO().WantCaptureMouse;
};
eventDispatcher->addEventListenerWithFixedPriority(_touchListener, highestPriority);
// add by halx99
auto stopAnyMouse = [=](EventMouse* event) {
if (ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)) {
if (ImGui::GetIO().WantCaptureMouse) {
event->stopPropagation();
}
};