diff --git a/cocos/2d/platform/desktop/CCGLView.cpp b/cocos/2d/platform/desktop/CCGLView.cpp index 9c2d4a390d..aea8f87d8a 100644 --- a/cocos/2d/platform/desktop/CCGLView.cpp +++ b/cocos/2d/platform/desktop/CCGLView.cpp @@ -529,9 +529,9 @@ void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int } else if(GLFW_RELEASE == action) { - _captured = false; - if (this->getViewPortRect().equals(Rect::ZERO) || this->getViewPortRect().containsPoint(Point(_mouseX,_mouseY))) + if (_captured) { + _captured = false; int id = 0; this->handleTouchesEnd(1, &id, &_mouseX, &_mouseY); } @@ -575,11 +575,8 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) if (_captured) { - if (this->getViewPortRect().equals(Rect::ZERO) || this->getViewPortRect().containsPoint(Point(_mouseX, _mouseY))) - { - int id = 0; - this->handleTouchesMove(1, &id, &_mouseX, &_mouseY); - } + int id = 0; + this->handleTouchesMove(1, &id, &_mouseX, &_mouseY); } EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE);