| 1093 | } |
| 1094 | |
| 1095 | void RenderViewImpl::onGLFWMouseCallBack(GLFWwindow* /*window*/, int button, int action, int /*modify*/) |
| 1096 | { |
| 1097 | if (!_isTouchDevice) |
| 1098 | { |
| 1099 | if (GLFW_MOUSE_BUTTON_LEFT == button) |
| 1100 | { |
| 1101 | if (GLFW_PRESS == action) |
| 1102 | { |
| 1103 | _captured = true; |
| 1104 | if (this->getViewPortRect().equals(ax::Rect::ZERO) || |
| 1105 | this->getViewPortRect().containsPoint(Vec2(_mouseX, _mouseY))) |
| 1106 | { |
| 1107 | intptr_t id = 0; |
| 1108 | this->handleTouchesBegin(1, &id, &_mouseX, &_mouseY); |
| 1109 | } |
| 1110 | } |
| 1111 | else if (GLFW_RELEASE == action) |
| 1112 | { |
| 1113 | if (_captured) |
| 1114 | { |
| 1115 | _captured = false; |
| 1116 | intptr_t id = 0; |
| 1117 | this->handleTouchesEnd(1, &id, &_mouseX, &_mouseY); |
| 1118 | } |
| 1119 | } |
| 1120 | } |
| 1121 | } |
| 1122 | |
| 1123 | float cursorX = transformInputX(_mouseX); |
| 1124 | float cursorY = transformInputY(_mouseY); |
| 1125 | |
| 1126 | if (GLFW_PRESS == action) |
| 1127 | { |
| 1128 | EventMouse event(EventMouse::MouseEventType::MOUSE_DOWN); |
| 1129 | event.setMouseInfo(cursorX, cursorY, static_cast<ax::EventMouse::MouseButton>(button)); |
| 1130 | Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); |
| 1131 | } |
| 1132 | else if (GLFW_RELEASE == action) |
| 1133 | { |
| 1134 | EventMouse event(EventMouse::MouseEventType::MOUSE_UP); |
| 1135 | event.setMouseInfo(cursorX, cursorY, static_cast<ax::EventMouse::MouseButton>(button)); |
| 1136 | Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); |
| 1137 | } |
| 1138 | } |
| 1139 | |
| 1140 | void RenderViewImpl::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) |
| 1141 | { |
no test coverage detected