Showing the changes to interface/src/devices/SixenseManager.cpp (1 of 6 files). Show all
Unified · Split
| @@ -472,7 +472,6 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers) · 471 unmodified lines | ||
| 472 | 472 | //Injecting mouse movements and clicks |
| 473 | 473 | void SixenseManager::emulateMouse(PalmData* palm, int index) { |
| 474 | 474 | MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); |
| 475 | − auto glCanvas = Application::getInstance()->getGLWidget(); | |
| 476 | 475 | QPoint pos; |
| 477 | 476 | |
| 478 | 477 | Qt::MouseButton bumperButton; |
| @@ -498,12 +497,12 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) { · 19 unmodified lines | ||
| 498 | 497 | // Get the angles, scaled between (-0.5,0.5) |
| 499 | 498 | float xAngle = (atan2(direction.z, direction.x) + M_PI_2); |
| 500 | 499 | float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2)); |
| 501 | − | |
| 500 | + auto canvasSize = qApp->getCanvasSize(); | |
| 502 | 501 | // Get the pixel range over which the xAngle and yAngle are scaled |
| 503 | − float cursorRange = glCanvas->width() * getCursorPixelRangeMult(); | |
| 502 | + float cursorRange = canvasSize.x * getCursorPixelRangeMult(); | |
| 504 | 503 | |
| 505 | − pos.setX(glCanvas->width() / 2.0f + cursorRange * xAngle); | |
| 506 | − pos.setY(glCanvas->height() / 2.0f + cursorRange * yAngle); | |
| 504 | + pos.setX(canvasSize.x / 2.0f + cursorRange * xAngle); | |
| 505 | + pos.setY(canvasSize.y / 2.0f + cursorRange * yAngle); | |
| 507 | 506 | |
| 508 | 507 | } |
| 509 | 508 | |