| 338 | } |
| 339 | |
| 340 | void Widget::mouseButtonHandler(int pButton, int pAction, int pMods) |
| 341 | { |
| 342 | double x, y; |
| 343 | glfwGetCursorPos(mWindow, &x, &y); |
| 344 | mLastXPos = float(x); |
| 345 | mLastYPos = float(y); |
| 346 | |
| 347 | mButton = -1; |
| 348 | if (pAction == GLFW_PRESS) { |
| 349 | switch(pButton) { |
| 350 | case GLFW_MOUSE_BUTTON_LEFT : mButton = GLFW_MOUSE_BUTTON_LEFT ; break; |
| 351 | case GLFW_MOUSE_BUTTON_RIGHT : mButton = GLFW_MOUSE_BUTTON_RIGHT ; break; |
| 352 | case GLFW_MOUSE_BUTTON_MIDDLE: mButton = GLFW_MOUSE_BUTTON_MIDDLE; break; |
| 353 | } |
| 354 | } |
| 355 | if (pMods == GLFW_MOD_ALT || pMods == GLFW_MOD_CONTROL) { |
| 356 | mButton += 10 * pMods; |
| 357 | } |
| 358 | // reset UI transforms upon mouse middle click |
| 359 | if (pButton == GLFW_MOUSE_BUTTON_MIDDLE && pMods == GLFW_MOD_CONTROL && pAction == GLFW_PRESS) { |
| 360 | setCellViewMatrix(float(x), float(y), IDENTITY); |
| 361 | setCellOrientationMatrix(float(x), float(y), IDENTITY); |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | void Widget::pollEvents() |
| 366 | { |